return new WikiFilePage( $title );
}
- /**
- * Constructor from a page id
- * @param int $id Article ID to load
- * @return ImagePage|null
- */
- public static function newFromID( $id ) {
- $t = Title::newFromID( $id );
- # @todo FIXME: Doesn't inherit right
- return $t == null ? null : new self( $t );
- # return $t == null ? null : new static( $t ); // PHP 5.3
- }
-
/**
* @param File $file
* @return void
}
# No need to display noarticletext, we use our own message, output in openShowImage()
- if ( $this->mPage->getID() ) {
+ if ( $this->mPage->getId() ) {
# NS_FILE is in the user language, but this section (the actual wikitext)
# should be in page content language
$pageLang = $this->getTitle()->getPageViewLanguage();
$out->addStyle( $css );
}
}
- // always show the local local Filepage.css, bug 29277
- $out->addModuleStyles( 'filepage' );
- // Add MediaWiki styles for a file page
- $out->addModuleStyles( 'mediawiki.action.view.filepage' );
+ $out->addModuleStyles( [
+ 'filepage', // always show the local local Filepage.css, bug 29277
+ 'mediawiki.action.view.filepage', // Add MediaWiki styles for a file page
+ ] );
+
}
/**
*/
public function getContentObject() {
$this->loadFile();
- if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getID() ) {
+ if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getId() ) {
return null;
}
return parent::getContentObject();
if ( is_null( $currentLanguage ) ) {
$currentLanguage = $defaultLang;
}
- $out->addHtml( $this->doRenderLangOpt( $renderLangOptions, $currentLanguage, $defaultLang ) );
+ $out->addHTML( $this->doRenderLangOpt( $renderLangOptions, $currentLanguage, $defaultLang ) );
}
// Add cannot animate thumbnail warning
}
} else {
# Image does not exist
- if ( !$this->getID() ) {
+ if ( !$this->getId() ) {
# No article exists either
# Show deletion log to be consistent with normal articles
LogEventsList::showLogExtract(
// by Article::View().
$out->setRobotPolicy( 'noindex,nofollow' );
$out->wrapWikiMsg( "<div id='mw-imagepage-nofile' class='plainlinks'>\n$1\n</div>", $nofile );
- if ( !$this->getID() && $wgSend404Code ) {
+ if ( !$this->getId() && $wgSend404Code ) {
// If there is no image, no shared image, and no description page,
// output a 404, to be consistent with Article::showMissingArticle.
$request->response()->statusHeader( 404 );
/**
* Make the text under the image to say what size preview
*
- * @param $params Array parameters for thumbnail
+ * @param $params array parameters for thumbnail
* @param $sizeLinkBigImagePreview HTML for the current size
* @return string HTML output
*/
$descText = $this->mPage->getFile()->getDescriptionText( $this->getContext()->getLanguage() );
/* Add canonical to head if there is no local page for this shared file */
- if ( $descUrl && $this->mPage->getID() == 0 ) {
+ if ( $descUrl && $this->mPage->getId() == 0 ) {
$out->setCanonicalUrl( $descUrl );
}
* @return ResultWrapper
*/
protected function queryImageLinks( $target, $limit ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
return $dbr->select(
[ 'imagelinks', 'page' ],