* Get the name of an image from its title object
* @param $title Title
*/
- function getNameFromTitle( $title ) {
+ function getNameFromTitle( Title $title ) {
if ( $this->initialCapital != MWNamespace::isCapitalized( NS_FILE ) ) {
global $wgContLang;
$name = $title->getUserCaseDBKey();
* @param $repo ForeignApiRepo
* @return ForeignAPIFile|null
*/
- static function newFromTitle( $title, $repo ) {
+ static function newFromTitle( Title $title, $repo ) {
$data = $repo->fetchImageQuery( array(
- 'titles' => 'File:' . $title->getDBKey(),
- 'iiprop' => self::getProps(),
- 'prop' => 'imageinfo',
+ 'titles' => 'File:' . $title->getDBKey(),
+ 'iiprop' => self::getProps(),
+ 'prop' => 'imageinfo',
'iimetadataversion' => MediaHandler::getMetadataVersion()
- ) );
+ ) );
$info = $repo->getImageInfo( $data );
: -1;
if( $lastRedirect >= 0 ) {
$newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to']);
- $img = new ForeignAPIFile( $newtitle, $repo, $info, true );
+ $img = new self( $newtitle, $repo, $info, true );
if( $img ) {
$img->redirectedFrom( $title->getDBkey() );
}
} else {
- $img = new ForeignAPIFile( $title, $repo, $info, true );
+ $img = new self( $title, $repo, $info, true );
}
return $img;
} else {
* Do not call this except from inside a repo class.
*/
function __construct( $title, $repo ) {
- if ( !is_object( $title ) ) {
+ if ( !is_object( $title ) ) { // LocalFile requires a title object
throw new MWException( __CLASS__ . ' constructor given bogus title.' );
}
*
* @param $title Title of page
*/
- function invalidateImageRedirect( $title ) {
+ function invalidateImageRedirect( Title $title ) {
global $wgMemc;
$memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) );
if ( $memcKey ) {