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)
 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.
 append ($srcPath, $toAppendPath, $flags=0)
 Append the contents of the source path to the given file.
 fileExistsBatch ($files, $flags=0)
 Checks existence of specified array 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
 $deletedHashLevels
 $fileMode
 $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.
 chmod ($path)
 Chmod a file, supressing the warnings.


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::append ( srcPath,
toAppendPath,
flags = 0 
)

Append the contents of the source path to the given file.

Parameters:
$srcPath string location of the source file
$toAppendPath string path to append to.
$flags Bitfield, may be FileRepo::DELETE_SOURCE to indicate that the source file should be deleted if possible
Returns:
mixed Status or false

Reimplemented from FileRepo.

Definition at line 230 of file FSRepo.php.

References FileRepo::newGood(), and resolveVirtualUrl().

FSRepo::chmod ( path  )  [protected]

Chmod a file, supressing the warnings.

Parameters:
String $path The path to change

Definition at line 620 of file FSRepo.php.

References $path, wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by deleteBatch(), publishBatch(), and storeBatch().

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 463 of file FSRepo.php.

References chmod(), 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 571 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 549 of file FSRepo.php.

References $name, and $path.

Referenced by enumFiles().

FSRepo::fileExistsBatch ( files,
flags = 0 
)

Checks existence of specified array of files.

Parameters:
array $files URLs of files to check
integer $flags Bitwise combination of the following flags: self::FILES_ONLY Mark file as existing only if it is a file (not directory)
Returns:
Either array of files and existence flags, or false

Reimplemented from FileRepo.

Definition at line 275 of file FSRepo.php.

References $files, $result, and resolveVirtualUrl().

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 331 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 537 of file FSRepo.php.

References $i, 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 589 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 579 of file FSRepo.php.

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

FSRepo::getRootDirectory (  ) 

Get the public root directory of the repository.

Definition at line 42 of file FSRepo.php.

FSRepo::getRootUrl (  ) 

Get the public root URL of the repository.

Definition at line 49 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 101 of file FSRepo.php.

References $path.

Referenced by storeTemp().

FSRepo::getZonePath ( zone  ) 

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

Definition at line 63 of file FSRepo.php.

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

FSRepo::getZoneUrl ( zone  ) 

See also:
FileRepo::getZoneUrl()

Reimplemented from FileRepo.

Definition at line 81 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 298 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 56 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 350 of file FSRepo.php.

References $i, $success, chmod(), 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 112 of file FSRepo.php.

References FileRepo::$url, and getZonePath().

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

FSRepo::simpleClean ( param  ) 

Definition at line 600 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 142 of file FSRepo.php.

References $i, chmod(), 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 315 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::$fileMode

Definition at line 9 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.


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

Generated on Sat Apr 30 22:57:38 2011 for MediaWiki by  doxygen 1.5.9