ForeignAPIRepo Class Reference
[FileRepo]

A foreign repository with a remote MediaWiki with an API thingy Very hacky and inefficient do not use except for testing :D. More...

Inherits FileRepo.

List of all members.

Public Member Functions

 __construct ($info)
 newFile ($title, $time=false)
 Per docs in FileRepo, this needs to return false if we don't support versioned files.
 storeBatch ($triplets, $flags=0)
 No-ops.
 storeTemp ($originalName, $srcPath)
 Pick a random name in the temp zone and store a file to it.
 append ($srcPath, $toAppendPath, $flags=0)
 Append the contents of the source path to the given file.
 publishBatch ($triplets, $flags=0)
 Publish a batch of files.
 deleteBatch ($sourceDestPairs)
 Move a group of files to the deletion archive.
 fileExistsBatch ($files, $flags=0)
 Checks existence of an array of files.
 getFileProps ($virtualUrl)
 Get properties of a file with a given virtual URL The virtual URL must refer to this repo Properties should ultimately be obtained via File::getPropsFromPath().
 getImageInfo ($title, $time=false)
 findBySha1 ($hash)
 Get an array or iterator of file objects for files that have a given SHA-1 content hash.
 getThumbUrl ($name, $width=-1, $height=-1)
 getThumbUrlFromCache ($name, $width, $height)
 getZoneUrl ($zone)
 canCacheThumbs ()
 Are we locally caching the thumbnails?

Public Attributes

 $fileFactory = array( 'ForeignAPIFile', 'newFromTitle' )
 Factory functions for creating new files Override these in the base class.
 $apiThumbCacheExpiry = 86400

Protected Member Functions

 queryImage ($query)
 fetchImageQuery ($query)

Protected Attributes

 $mQueryCache = array()
 $mFileExists = array()


Detailed Description

A foreign repository with a remote MediaWiki with an API thingy Very hacky and inefficient do not use except for testing :D.

Example config:

$wgForeignFileRepos[] = array( 'class' => 'ForeignAPIRepo', 'name' => 'shared', 'apibase' => 'http://en.wikipedia.org/w/api.php', 'fetchDescription' => true, // Optional 'descriptionCacheExpiry' => 3600, );

Definition at line 20 of file ForeignAPIRepo.php.


Constructor & Destructor Documentation

ForeignAPIRepo::__construct ( info  ) 

Reimplemented from FileRepo.

Definition at line 26 of file ForeignAPIRepo.php.

References $wgLocalFileRepo, and canCacheThumbs().


Member Function Documentation

ForeignAPIRepo::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 66 of file ForeignAPIRepo.php.

ForeignAPIRepo::canCacheThumbs (  ) 

Are we locally caching the thumbnails?

Returns:
bool

Definition at line 245 of file ForeignAPIRepo.php.

Referenced by __construct(), and getThumbUrlFromCache().

ForeignAPIRepo::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.

The overwrite policy is determined by the repository -- currently FSRepo assumes a naming scheme in the deleted zone based on content hash, as opposed to the public zone which is assumed to be unique.

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.

Definition at line 72 of file ForeignAPIRepo.php.

ForeignAPIRepo::fetchImageQuery ( query  )  [protected]

ForeignAPIRepo::fileExistsBatch ( files,
flags = 0 
)

Checks existence of an array of files.

Parameters:
array $files URLs (or paths) 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 77 of file ForeignAPIRepo.php.

References $files, $i, and fetchImageQuery().

ForeignAPIRepo::findBySha1 ( hash  ) 

Get an array or iterator of file objects for files that have a given SHA-1 content hash.

STUB

Reimplemented from FileRepo.

Definition at line 157 of file ForeignAPIRepo.php.

References fetchImageQuery(), and Title::makeTitle().

ForeignAPIRepo::getFileProps ( virtualUrl  ) 

Get properties of a file with a given virtual URL The virtual URL must refer to this repo Properties should ultimately be obtained via File::getPropsFromPath().

Reimplemented from FileRepo.

Definition at line 102 of file ForeignAPIRepo.php.

ForeignAPIRepo::getImageInfo ( title,
time = false 
)

Definition at line 150 of file ForeignAPIRepo.php.

References $title, and queryImage().

ForeignAPIRepo::getThumbUrl ( name,
width = -1,
height = -1 
)

Definition at line 171 of file ForeignAPIRepo.php.

References $name, queryImage(), and wfDebug().

Referenced by getThumbUrlFromCache().

ForeignAPIRepo::getThumbUrlFromCache ( name,
width,
height 
)

ForeignAPIRepo::getZoneUrl ( zone  ) 

See also:
FileRepo::getZoneUrl()

Reimplemented from FileRepo.

Definition at line 230 of file ForeignAPIRepo.php.

ForeignAPIRepo::newFile ( title,
time = false 
)

Per docs in FileRepo, this needs to return false if we don't support versioned files.

Well, we don't.

Reimplemented from FileRepo.

Definition at line 50 of file ForeignAPIRepo.php.

References $title.

ForeignAPIRepo::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 69 of file ForeignAPIRepo.php.

ForeignAPIRepo::queryImage ( query  )  [protected]

Definition at line 106 of file ForeignAPIRepo.php.

References fetchImageQuery().

Referenced by getImageInfo(), and getThumbUrl().

ForeignAPIRepo::storeBatch ( triplets,
flags = 0 
)

No-ops.

Reimplemented from FileRepo.

Definition at line 60 of file ForeignAPIRepo.php.

ForeignAPIRepo::storeTemp ( originalName,
srcPath 
)

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

Returns a FileRepoStatus object with the URL in the value.

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.

Reimplemented from FileRepo.

Definition at line 63 of file ForeignAPIRepo.php.


Member Data Documentation

ForeignAPIRepo::$apiThumbCacheExpiry = 86400

Definition at line 22 of file ForeignAPIRepo.php.

ForeignAPIRepo::$fileFactory = array( 'ForeignAPIFile', 'newFromTitle' )

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

Reimplemented from FileRepo.

Definition at line 21 of file ForeignAPIRepo.php.

ForeignAPIRepo::$mFileExists = array() [protected]

Definition at line 24 of file ForeignAPIRepo.php.

ForeignAPIRepo::$mQueryCache = array() [protected]

Definition at line 23 of file ForeignAPIRepo.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