47 public function publish( $srcPath, $flags = 0, array $options = [] ) {
57 public function restore( $versions = [], $unsuppress =
false ) {
77 public function move( $target ) {
96 if ( !$this->repo->fetchDescription ) {
101 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
106 $touched = $this->repo->getReplicaDB()->selectField(
111 'page_title' => $this->title->getDBkey()
115 if ( $touched ===
false ) {
119 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
122 return $cache->getWithSetCallback(
123 $this->repo->getLocalCacheKey(
124 'file-foreign-description',
129 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
130 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
131 wfDebug(
"Fetching shared description from $renderUrl" );
132 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
133 get( $renderUrl, [], $fname );
135 $ttl = WANObjectCache::TTL_UNCACHEABLE;
151 $dbr = $this->repo->getReplicaDB();
152 $pageId =
$dbr->selectField(
157 'page_title' => $this->title->getDBkey()
162 if ( $pageId !==
false ) {
163 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
164 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.
if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode $wgLang
string $url
The URL corresponding to one of the four basic zones.
getName()
Return the name of this file.
FileRepo LocalRepo ForeignAPIRepo false $repo
Some member variables can be lazy-initialised using __get().
getDescriptionUrl()
Get the URL of the image description page.
Foreign file from a reachable database in the same wiki farm.
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, UserIdentity $user, $suppress=false)
restore( $versions=[], $unsuppress=false)
Base class for language-specific code.
Local file in the wiki's own database.
if(!isset( $args[0])) $lang