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.
 publishBatch ($triplets, $flags=0)
 Publish a batch of files.
 deleteBatch ($sourceDestPairs)
 Move a group of files to the deletion archive.
 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)
 getThumbUrl ($name, $width=-1, $height=-1)
 getThumbUrlFromCache ($name, $width, $height)
 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 = 0

Protected Member Functions

 queryImage ($query)
 fetchImageQuery ($query)

Protected Attributes

 $mQueryCache = 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 25 of file ForeignAPIRepo.php.


Member Function Documentation

ForeignAPIRepo::canCacheThumbs (  ) 

Are we locally caching the thumbnails?

Returns:
bool

Definition at line 183 of file ForeignAPIRepo.php.

Referenced by 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 57 of file ForeignAPIRepo.php.

ForeignAPIRepo::fetchImageQuery ( query  )  [protected]

Definition at line 77 of file ForeignAPIRepo.php.

References $key, $url, $wgMemc, Http::get(), and wfMemcKey().

Referenced by findBySha1(), and queryImage().

ForeignAPIRepo::findBySha1 ( hash  ) 

Reimplemented from FileRepo.

Definition at line 115 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 60 of file ForeignAPIRepo.php.

ForeignAPIRepo::getImageInfo ( title,
time = false 
)

Definition at line 108 of file ForeignAPIRepo.php.

References $title, and queryImage().

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

Definition at line 129 of file ForeignAPIRepo.php.

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

Referenced by getThumbUrlFromCache().

ForeignAPIRepo::getThumbUrlFromCache ( name,
width,
height 
)

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 38 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 54 of file ForeignAPIRepo.php.

ForeignAPIRepo::queryImage ( query  )  [protected]

Definition at line 64 of file ForeignAPIRepo.php.

References fetchImageQuery().

Referenced by getImageInfo(), and getThumbUrl().

ForeignAPIRepo::storeBatch ( triplets,
flags = 0 
)

No-ops.

Reimplemented from FileRepo.

Definition at line 48 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 51 of file ForeignAPIRepo.php.


Member Data Documentation

ForeignAPIRepo::$apiThumbCacheExpiry = 0

Reimplemented from FileRepo.

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::$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 Sep 5 02:08:38 2009 for MediaWiki by  doxygen 1.5.9