FSRepo Class Reference
[FileRepo]

A repository for files accessible via the local filesystem. More...

Inherits FileRepo.

Inherited by LocalRepo.

List of all members.

Public Member Functions

 __construct ($info)
 getRootDirectory ()
 Get the public root directory of the repository.
 getRootUrl ()
 Get the public root URL of the repository.
 isHashed ()
 Returns true if the repository uses a multi-level directory structure.
 getZonePath ($zone)
 Get the local directory corresponding to one of the three basic zones.
 getZoneUrl ($zone)
 Get the URL corresponding to one of the three basic zones.
 getVirtualUrl ($suffix=false)
 Get a URL referring to this repository, with the private mwrepo protocol.
 resolveVirtualUrl ($url)
 Get the local path corresponding to a virtual URL.
 storeBatch ($triplets, $flags=0)
 Store a batch of files.
 storeTemp ($originalName, $srcPath)
 Pick a random name in the temp zone and store a file to it.
 freeTemp ($virtualUrl)
 Remove a temporary file or mark it for garbage collection.
 publishBatch ($triplets, $flags=0)
 Publish a batch of files.
 deleteBatch ($sourceDestPairs)
 Move a group of files to the deletion archive.
 getDeletedHashPath ($key)
 Get a relative path for a deletion archive key, e.g.
 enumFilesInFS ($callback)
 Call a callback function for every file in the repository.
 enumFiles ($callback)
 Call a callback function for every file in the repository May use either the database or the filesystem.
 getFileProps ($virtualUrl)
 Get properties of a file with a given virtual URL The virtual URL must refer to this repo.
 getErrorCleanupFunction ()
 Path disclosure protection functions.
 simpleClean ($param)

Public Attributes

 $directory
 $deletedDir
 $url
 $deletedHashLevels
 $fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' )
 Factory functions for creating new files Override these in the base class.
 $oldFileFactory = false
 $pathDisclosureProtection = 'simple'

Protected Member Functions

 initDeletedDir ($dir)
 Take all available measures to prevent web accessibility of new deleted directories, in case the user has not configured offline storage.


Detailed Description

A repository for files accessible via the local filesystem.

Does not support database access or registration.

Definition at line 8 of file FSRepo.php.


Constructor & Destructor Documentation

FSRepo::__construct ( info  ) 

Reimplemented from FileRepo.

Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.

Definition at line 14 of file FSRepo.php.


Member Function Documentation

FSRepo::deleteBatch ( sourceDestPairs  ) 

Move a group of files to the deletion archive.

If no valid deletion archive is configured, this may either delete the file or throw an exception, depending on the preference of the repository.

Parameters:
array $sourceDestPairs Array of source/destination pairs. Each element is a two-element array containing the source file path relative to the public root in the first element, and the archive file path relative to the deleted zone root in the second element.
Returns:
FileRepoStatus

Reimplemented from FileRepo.

Reimplemented in ForeignDBRepo, and ForeignDBViaLBRepo.

Definition at line 384 of file FSRepo.php.

References $status, initDeletedDir(), FileRepo::newGood(), FileRepo::validateFilename(), and wfMkdirParents().

FSRepo::enumFiles ( callback  ) 

Call a callback function for every file in the repository May use either the database or the filesystem.

Reimplemented from FileRepo.

Definition at line 492 of file FSRepo.php.

References enumFilesInFS().

FSRepo::enumFilesInFS ( callback  ) 

Call a callback function for every file in the repository.

Uses the filesystem even in child classes.

Definition at line 470 of file FSRepo.php.

References $name, and $path.

Referenced by enumFiles().

FSRepo::freeTemp ( virtualUrl  ) 

Remove a temporary file or mark it for garbage collection.

Parameters:
string $virtualUrl The virtual URL returned by storeTemp
Returns:
boolean True on success, false on failure

Reimplemented from FileRepo.

Definition at line 252 of file FSRepo.php.

References $path, $success, resolveVirtualUrl(), wfDebug(), wfRestoreWarnings(), and wfSuppressWarnings().

FSRepo::getDeletedHashPath ( key  ) 

Get a relative path for a deletion archive key, e.g.

s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg

Definition at line 458 of file FSRepo.php.

References $i, $key, and $path.

Referenced by LocalRepo::cleanupDeletedBatch().

FSRepo::getErrorCleanupFunction (  ) 

Path disclosure protection functions.

Get a callback function to use for cleaning error message parameters

Reimplemented from FileRepo.

Definition at line 510 of file FSRepo.php.

FSRepo::getFileProps ( virtualUrl  ) 

Get properties of a file with a given virtual URL The virtual URL must refer to this repo.

Reimplemented from FileRepo.

Definition at line 500 of file FSRepo.php.

References $path, File::getPropsFromPath(), and resolveVirtualUrl().

FSRepo::getRootDirectory (  ) 

Get the public root directory of the repository.

Definition at line 31 of file FSRepo.php.

FSRepo::getRootUrl (  ) 

Get the public root URL of the repository.

Definition at line 38 of file FSRepo.php.

FSRepo::getVirtualUrl ( suffix = false  ) 

Get a URL referring to this repository, with the private mwrepo protocol.

The suffix, if supplied, is considered to be unencoded, and will be URL-encoded before being returned.

Definition at line 86 of file FSRepo.php.

References $path, and $suffix.

Referenced by storeTemp().

FSRepo::getZonePath ( zone  ) 

Get the local directory corresponding to one of the three basic zones.

Definition at line 52 of file FSRepo.php.

Referenced by LocalRepo::cleanupDeletedBatch(), initDeletedDir(), resolveVirtualUrl(), and storeBatch().

FSRepo::getZoneUrl ( zone  ) 

Get the URL corresponding to one of the three basic zones.

Definition at line 68 of file FSRepo.php.

FSRepo::initDeletedDir ( dir  )  [protected]

Take all available measures to prevent web accessibility of new deleted directories, in case the user has not configured offline storage.

Definition at line 219 of file FSRepo.php.

References getZonePath().

Referenced by deleteBatch(), and storeBatch().

FSRepo::isHashed (  ) 

Returns true if the repository uses a multi-level directory structure.

Definition at line 45 of file FSRepo.php.

FSRepo::publishBatch ( triplets,
flags = 0 
)

Publish a batch of files.

Parameters:
array $triplets (source,dest,archive) triplets as per publish()
integer $flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate that the source files should be deleted if possible

Reimplemented from FileRepo.

Definition at line 271 of file FSRepo.php.

References $flags, $i, $status, $success, FileRepo::newFatal(), FileRepo::newGood(), resolveVirtualUrl(), FileRepo::validateFilename(), wfDebug(), wfMkdirParents(), wfRestoreWarnings(), and wfSuppressWarnings().

FSRepo::resolveVirtualUrl ( url  ) 

Get the local path corresponding to a virtual URL.

Definition at line 97 of file FSRepo.php.

References $url, and getZonePath().

Referenced by freeTemp(), getFileProps(), publishBatch(), and storeBatch().

FSRepo::simpleClean ( param  ) 

Definition at line 521 of file FSRepo.php.

References $IP.

FSRepo::storeBatch ( triplets,
flags = 0 
)

Store a batch of files.

Parameters:
array $triplets (src,zone,dest) triplets as per store()
integer $flags Bitwise combination of the following flags: self::DELETE_SOURCE Delete the source file after upload self::OVERWRITE Overwrite an existing destination file instead of failing self::OVERWRITE_SAME Overwrite the file if the destination exists and has the same contents as the source

Reimplemented from FileRepo.

Definition at line 127 of file FSRepo.php.

References $flags, $i, $status, getZonePath(), initDeletedDir(), FileRepo::newFatal(), FileRepo::newGood(), resolveVirtualUrl(), FileRepo::validateFilename(), wfIsWindows(), and wfMkdirParents().

FSRepo::storeTemp ( originalName,
srcPath 
)

Pick a random name in the temp zone and store a file to it.

Parameters:
string $originalName The base name of the file as specified by the user. The file extension will be maintained.
string $srcPath The current location of the file.
Returns:
FileRepoStatus object with the URL in the value.

Reimplemented from FileRepo.

Definition at line 236 of file FSRepo.php.

References $result, FileRepo::getHashPath(), getVirtualUrl(), and FileRepo::store().


Member Data Documentation

FSRepo::$deletedDir

Definition at line 9 of file FSRepo.php.

FSRepo::$deletedHashLevels

Definition at line 9 of file FSRepo.php.

FSRepo::$directory

Definition at line 9 of file FSRepo.php.

FSRepo::$fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' )

Factory functions for creating new files Override these in the base class.

Reimplemented from FileRepo.

Reimplemented in ForeignDBRepo, ForeignDBViaLBRepo, and LocalRepo.

Definition at line 10 of file FSRepo.php.

FSRepo::$oldFileFactory = false

Reimplemented from FileRepo.

Reimplemented in LocalRepo.

Definition at line 11 of file FSRepo.php.

FSRepo::$pathDisclosureProtection = 'simple'

Reimplemented from FileRepo.

Definition at line 12 of file FSRepo.php.

FSRepo::$url

Definition at line 9 of file FSRepo.php.

Referenced by resolveVirtualUrl().


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:38 2009 for MediaWiki by  doxygen 1.5.9