49 public function publish( $srcPath, $flags = 0, array $options = [] ) {
78 public function restore( $versions = [], $unsuppress =
false ) {
90 public function delete( $reason, $suppress =
false,
$user = null ) {
111 public function move( $target ) {
130 if ( !$this->repo->fetchDescription ) {
135 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
140 $touched = $this->repo->getReplicaDB()->selectField(
145 'page_title' => $this->title->getDBkey()
149 if ( $touched ===
false ) {
153 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
156 return $cache->getWithSetCallback(
157 $this->repo->getLocalCacheKey(
158 'ForeignFileDescription',
163 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
164 function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
165 wfDebug(
"Fetching shared description from $renderUrl" );
166 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
167 get( $renderUrl, [], $fname );
169 $ttl = WANObjectCache::TTL_UNCACHEABLE;
185 $dbr = $this->repo->getReplicaDB();
186 $pageId =
$dbr->selectField(
191 'page_title' => $this->title->getDBkey()
196 if ( $pageId !==
false ) {
197 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
198 if (
$url !==
false ) {
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
string $url
The URL corresponding to one of the four basic zones.
getName()
Return the name of this file.
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
getDescriptionUrl()
Get the URL of the image description page.
Foreign file with an accessible MediaWiki database.
publish( $srcPath, $flags=0, array $options=[])
getDescriptionText(Language $lang=null)
getDescriptionShortUrl()
Get short description URL for a file based on the page ID.
deleteFile( $reason, User $user, $suppress=false)
restore( $versions=[], $unsuppress=false)
recordUpload( $oldver, $desc, $license='', $copyStatus='', $source='', $watch=false, $timestamp=false, User $user=null)
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Class to represent a local file in the wiki's own database.
string $timestamp
Upload timestamp.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(!isset( $args[0])) $lang