46 public function publish( $srcPath, $flags = 0, array $options = [] ) {
56 public function restore( $versions = [], $unsuppress =
false ) {
76 public function move( $target ) {
95 if ( !$this->repo->fetchDescription ) {
100 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
105 $touched = $this->repo->getReplicaDB()->selectField(
110 'page_title' => $this->title->getDBkey()
114 if ( $touched ===
false ) {
118 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
121 return $cache->getWithSetCallback(
122 $this->repo->getLocalCacheKey(
123 'file-foreign-description',
128 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
129 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
130 wfDebug(
"Fetching shared description from $renderUrl" );
131 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
132 get( $renderUrl, [], $fname );
134 $ttl = WANObjectCache::TTL_UNCACHEABLE;
150 $dbr = $this->repo->getReplicaDB();
151 $pageId =
$dbr->selectField(
156 'page_title' => $this->title->getDBkey()
161 if ( $pageId !==
false ) {
162 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
163 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 bool $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