<?php
class ForeignDBFile extends LocalFile {
- function newFromTitle( $title, $repo ) {
+ static function newFromTitle( $title, $repo ) {
return new self( $title, $repo );
}
* Create a LocalFile from a title
* Do not call this except from inside a repo class.
*/
- function newFromTitle( $title, $repo ) {
+ static function newFromTitle( $title, $repo ) {
return new self( $title, $repo );
}
* Create a LocalFile from a title
* Do not call this except from inside a repo class.
*/
- function newFromRow( $row, $repo ) {
+ static function newFromRow( $row, $repo ) {
$title = Title::makeTitle( NS_IMAGE, $row->img_name );
$file = new self( $title, $repo );
$file->loadFromRow( $row );
* Do not use in core code.
* @deprecated
*/
- function newFromTitle( $title, $time = false ) {
+ static function newFromTitle( $title, $time = false ) {
$img = wfFindFile( $title, $time );
if ( !$img ) {
$img = wfLocalFile( $title );
return $img;
}
+ /**
+ * Wrapper for wfFindFile(), for backwards-compatibility only.
+ * Do not use in core code.
+ *
+ * @param string $name name of the image, used to create a title object using Title::makeTitleSafe
+ * @return image object or null if invalid title
+ * @deprecated
+ */
+ static function newFromName( $name ) {
+ $title = Title::makeTitleSafe( NS_IMAGE, $name );
+ if ( is_object( $title ) ) {
+ $img = wfFindFile( $title );
+ if ( !$img ) {
+ $img = wfLocalFile( $title );
+ }
+ return $img;
+ } else {
+ return NULL;
+ }
+ }
+
/**
* Return the URL of an image, provided its name.
*
const CACHE_VERSION = 1;
const MAX_CACHE_ROWS = 20;
- function newFromTitle( $title, $repo, $time ) {
+ static function newFromTitle( $title, $repo, $time ) {
return new self( $title, $repo, $time, null );
}
- function newFromArchiveName( $title, $repo, $archiveName ) {
+ static function newFromArchiveName( $title, $repo, $archiveName ) {
return new self( $title, $repo, null, $archiveName );
}
- function newFromRow( $row, $repo ) {
+ static function newFromRow( $row, $repo ) {
$title = Title::makeTitle( NS_IMAGE, $row->oi_name );
$file = new self( $title, $repo, null, $row->oi_archive_name );
$file->loadFromRow( $row, 'oi_' );
class UnregisteredLocalFile extends File {
var $title, $path, $mime, $handler, $dims;
- function newFromPath( $path, $mime ) {
+ static function newFromPath( $path, $mime ) {
return new UnregisteredLocalFile( false, false, $path, $mime );
}
- function newFromTitle( $title, $repo ) {
+ static function newFromTitle( $title, $repo ) {
return new UnregisteredLocalFile( $title, $repo, false, false );
}