41 parent::__construct(
$title );
51 $this->mFileLoaded =
true;
58 if ( $this->mFileLoaded ) {
61 $this->mFileLoaded =
true;
64 if ( !$this->mFile ) {
67 $this->mRepo = $this->mFile->getRepo();
76 if ( $this->mFile->isLocal() ) {
77 return parent::getRedirectTarget();
80 $from = $this->mFile->getRedirected();
81 $to = $this->mFile->getName();
85 $this->mRedirectTarget = Title::makeTitle(
NS_FILE, $to );
94 if ( $this->mFile->isLocal() ) {
95 return parent::followRedirect();
97 $from = $this->mFile->getRedirected();
98 $to = $this->mFile->getName();
102 return Title::makeTitle(
NS_FILE, $to );
110 if ( $this->mFile->isLocal() ) {
111 return parent::isRedirect();
114 return (
bool)$this->mFile->getRedirected();
122 return $this->mFile->isLocal();
138 if ( !is_null( $this->mDupes ) ) {
141 $hash = $this->mFile->getSha1();
148 $self = $this->mFile->getRepoName() .
':' . $this->mFile->getName();
149 $size = $this->mFile->getSize();
154 foreach ( $dupes
as $index => $file ) {
155 $key = $file->getRepoName() .
':' . $file->getName();
156 if ( $key ==
$self ) {
157 unset( $dupes[$index] );
159 if ( $file->getSize() != $size ) {
160 unset( $dupes[$index] );
163 $this->mDupes = $dupes;
174 if ( $this->mFile->exists() ) {
175 wfDebug(
'ImagePage::doPurge purging ' . $this->mFile->getName() .
"\n" );
176 DeferredUpdates::addUpdate(
new HTMLCacheUpdate( $this->mTitle,
'imagelinks' ) );
178 wfDebug(
'ImagePage::doPurge no image for '
179 . $this->mFile->getName() .
"; limiting purge to cache only\n" );
186 $this->mFile->purgeCache( [
'forThumbRefresh' =>
true ] );
189 foreach ( $this->mFile->getHistory()
as $oldFile ) {
190 $oldFile->purgeCache( [
'forThumbRefresh' =>
true ] );
193 if ( $this->mRepo ) {
195 $this->mRepo->invalidateImageRedirect( $this->mTitle );
198 return parent::doPurge();
216 wfDebug( __CLASS__ .
'::' . __METHOD__ .
" is not supported for this file\n" );
221 $repo = $file->getRepo();
222 $dbr = $repo->getReplicaDB();
225 [
'page',
'categorylinks' ],
227 'page_title' =>
'cl_to',
231 'page_namespace' =>
$title->getNamespace(),
232 'page_title' =>
$title->getDBkey(),
236 [
'categorylinks' => [
'INNER JOIN',
'page_id = cl_from' ] ]
247 return $this->
getFile()->getRepo()->getDisplayName();
255 return $this->
getFile()->getDescriptionUrl();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfFindFile( $title, $options=[])
Find a file.
Implements some public methods and some protected utility functions which are required by multiple ch...
Class to invalidate the HTML cache of all the pages linking to a given title.
Class to represent a local file in the wiki's own database.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
static singleton()
Get a RepoGroup instance.
static newFromResult( $res)
Special handling for file pages.
doPurge()
Override handling of action=purge.
getForeignCategories()
Get the categories this file is a member of on the wiki where it was uploaded.
Class representing a MediaWiki article and history.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace and then decline to actually register it file or subcat img or subcat $title
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php