* @private
*/
var $id, # filearchive row ID
- $title, # image title
$name, # image name
$group, # FileStore storage group
$key, # FileStore sha1 key
$dataLoaded, # Whether or not all this has been loaded from the database (loadFromXxx)
$deleted; # Bitfield akin to rev_deleted
+ /**
+ * @var Title
+ */
+ var $title; # image title
+
/**#@-*/
function __construct( $title, $id=0, $key='' ) {
/**
* The following member variables are not lazy-initialised
*/
- var $repo, $title, $lastError, $redirected, $redirectedTitle;
+
+ /**
+ * @var LocalRepo
+ */
+ var $repo;
+
+ /**
+ * @var Title
+ */
+ var $title;
+
+ var $lastError, $redirected, $redirectedTitle;
/**
* Call this constructor from child classes
if( $this->isLocal() ) {
global $wgParser;
$revision = Revision::newFromTitle( $this->title );
- if ( !$revision ) return false;
+ if ( !$revision ) {
+ return false;
+ }
$text = $revision->getText();
- if ( !$text ) return false;
+ if ( !$text ) {
+ return false;
+ }
$pout = $wgParser->parse( $text, $this->title, new ParserOptions() );
return $pout->getText();
}
* instance of the repository's old file class instead of a
* current file. Repositories not supporting version control
* should return false if this parameter is set.
+ *
+ * @return File
*/
function newFile( $title, $time = false ) {
if ( !($title instanceof Title) ) {
return false;
}
$redir = $this->checkRedirect( $title );
- if( $redir && $redir->getNamespace() == NS_FILE) {
+ if( $redir && $title->getNamespace() == NS_FILE) {
$img = $this->newFile( $redir );
if( !$img ) {
return false;
* of the repository's old file class instead of a current
* file. Repositories not supporting version control should
* return false if this parameter is set.
+ *
+ * @return File
*/
function newFileFromKey( $sha1, $time = false ) {
if ( $time ) {
/**
* Get the name of an image from its title object
+ * @param $title Title
*/
function getNameFromTitle( $title ) {
if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
* STUB
*
* @param $title Title of image
+ * @return Bool
*/
function checkRedirect( $title ) {
return false;
return $result;
}
+ /**
+ * @param $repo FileRepo
+ */
function __construct( $repo = false ) {
if ( $repo ) {
$this->cleanCallback = $repo->getErrorCleanupFunction();
class ForeignAPIFile extends File {
private $mExists;
-
+
+ /**
+ * @param $title
+ * @param $repo ForeignApiRepo
+ * @param $info
+ * @param bool $exists
+ */
function __construct( $title, $repo, $info, $exists = false ) {
parent::__construct( $title, $repo );
$this->mInfo = $info;
/**
* Create a LocalFile from a SHA-1 key
* Do not call this except from inside a repo class.
+ * @param $sha1
+ * @param $repo LocalRepo
+ * @param $timestamp
*/
static function newFromKey( $sha1, $repo, $timestamp = false ) {
$conds = array( 'img_sha1' => $sha1 );
* @ingroup FileRepo
*/
class LocalFileDeleteBatch {
- var $file, $reason, $srcRels = array(), $archiveUrls = array(), $deletionBatch, $suppress;
+
+ /**
+ * @var LocalFile
+ */
+ var $file;
+
+ var $reason, $srcRels = array(), $archiveUrls = array(), $deletionBatch, $suppress;
var $status;
function __construct( File $file, $reason = '', $suppress = false ) {
* @ingroup FileRepo
*/
class LocalFileRestoreBatch {
- var $file, $cleanupBatch, $ids, $all, $unsuppress = false;
+ /**
+ * @var LocalFile
+ */
+ var $file;
+
+ var $cleanupBatch, $ids, $all, $unsuppress = false;
function __construct( File $file, $unsuppress = false ) {
$this->file = $file;
/**
* Function link Title::getArticleID().
* We can't say Title object, what database it should use, so we duplicate that function here.
+ * @param $title Title
*/
protected function getArticleID( $title ) {
if( !$title instanceof Title ) {
$file->loadFromRow( $row, 'oi_' );
return $file;
}
-
+
+ /**
+ * @static
+ * @param $sha1
+ * @param $repo LocalRepo
+ * @param bool $timestamp
+ * @return bool|OldLocalFile
+ */
static function newFromKey( $sha1, $repo, $timestamp = false ) {
$conds = array( 'oi_sha1' => $sha1 );
if( $timestamp ) {
* @ingroup FileRepo
*/
class RepoGroup {
- var $localRepo, $foreignRepos, $reposInitialised = false;
+
+ /**
+ * @var LocalRepo
+ */
+ var $localRepo;
+
+ var $foreignRepos, $reposInitialised = false;
var $localInfo, $foreignInfo;
var $cache;
* @ingroup FileRepo
*/
class UnregisteredLocalFile extends File {
- var $title, $path, $mime, $handler, $dims;
+ var $title, $path, $mime, $dims;
+
+ /**
+ * @var MediaHandler
+ */
+ var $handler;
static function newFromPath( $path, $mime ) {
return new UnregisteredLocalFile( false, false, $path, $mime );
return new UnregisteredLocalFile( $title, $repo, false, false );
}
+ /**
+ * @throws MWException
+ * @param bool $title
+ * @param $repo FSRepo
+ * @param bool $path
+ * @param bool $mime
+ */
function __construct( $title = false, $repo = false, $path = false, $mime = false ) {
if ( !( $title && $repo ) && !$path ) {
throw new MWException( __METHOD__.': not enough parameters, must specify title and repo, or a full path' );
/**
* Get a MediaHandler for a given MIME type from the instance cache
+ *
+ * @return MediaHandler
*/
static function getHandler( $type ) {
global $wgMediaHandlers;