48 public function publish( $srcPath, $flags = 0, array $options = [] ) {
58 public function restore( $versions = [], $unsuppress =
false ) {
78 public function move( $target ) {
97 if ( !$this->repo->fetchDescription ) {
102 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(), $lang->getCode() );
107 $touched = $this->repo->getReplicaDB()->newSelectQueryBuilder()
108 ->select(
'page_touched' )
110 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
111 ->caller( __METHOD__ )->fetchField();
112 if ( $touched ===
false ) {
116 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
119 return $cache->getWithSetCallback(
120 $this->repo->getLocalCacheKey(
121 'file-foreign-description',
126 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
127 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
128 wfDebug(
"Fetching shared description from $renderUrl" );
129 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
130 get( $renderUrl, [], $fname );
132 $ttl = WANObjectCache::TTL_UNCACHEABLE;
148 $dbr = $this->repo->getReplicaDB();
149 $pageId = $dbr->newSelectQueryBuilder()
150 ->select(
'page_id' )
152 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
153 ->caller( __METHOD__ )->fetchField();
155 if ( $pageId !==
false ) {
156 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
157 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.