42 parent::__construct(
$title );
52 $this->mFileLoaded =
true;
59 $services = MediaWikiServices::getInstance();
60 if ( $this->mFileLoaded ) {
63 $this->mFileLoaded =
true;
65 $this->mFile = $services->getRepoGroup()->findFile( $this->mTitle );
66 if ( !$this->mFile ) {
67 $this->mFile = $services->getRepoGroup()->getLocalRepo()
68 ->newFile( $this->mTitle );
70 $this->mRepo = $this->mFile->getRepo();
79 if ( $this->mFile->isLocal() ) {
80 return parent::getRedirectTarget();
83 $from = $this->mFile->getRedirected();
84 $to = $this->mFile->getName();
97 if ( $this->mFile->isLocal() ) {
98 return parent::followRedirect();
100 $from = $this->mFile->getRedirected();
101 $to = $this->mFile->getName();
102 if ( $from == $to ) {
113 if ( $this->mFile->isLocal() ) {
114 return parent::isRedirect();
117 return (
bool)$this->mFile->getRedirected();
125 return $this->mFile->isLocal();
141 if ( !is_null( $this->mDupes ) ) {
144 $hash = $this->mFile->getSha1();
151 $self = $this->mFile->getRepoName() .
':' . $this->mFile->getName();
152 $size = $this->mFile->getSize();
157 foreach ( $dupes as $index =>
$file ) {
158 $key =
$file->getRepoName() .
':' .
$file->getName();
159 if ( $key ==
$self ) {
160 unset( $dupes[$index] );
162 if (
$file->getSize() != $size ) {
163 unset( $dupes[$index] );
166 $this->mDupes = $dupes;
177 if ( $this->mFile->exists() ) {
178 wfDebug(
'ImagePage::doPurge purging ' . $this->mFile->getName() .
"\n" );
182 [
'causeAction' =>
'file-purge' ]
186 wfDebug(
'ImagePage::doPurge no image for '
187 . $this->mFile->getName() .
"; limiting purge to cache only\n" );
194 $this->mFile->purgeCache( [
'forThumbRefresh' =>
true ] );
197 foreach ( $this->mFile->getHistory() as $oldFile ) {
198 $oldFile->purgeCache( [
'forThumbRefresh' =>
true ] );
201 if ( $this->mRepo ) {
203 $this->mRepo->invalidateImageRedirect( $this->mTitle );
206 return parent::doPurge();
224 wfDebug( __CLASS__ .
'::' . __METHOD__ .
" is not supported for this file\n" );
229 $repo =
$file->getRepo();
230 $dbr = $repo->getReplicaDB();
233 [
'page',
'categorylinks' ],
235 'page_title' =>
'cl_to',
239 'page_namespace' =>
$title->getNamespace(),
240 'page_title' =>
$title->getDBkey(),
244 [
'categorylinks' => [
'JOIN',
'page_id = cl_from' ] ]
255 return $this->
getFile()->getRepo()->getDisplayName();
263 return $this->
getFile()->getDescriptionUrl();