49 public function publish( $srcPath, $flags = 0, array $options = [] ) {
58 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()->newSelectQueryBuilder()
106 ->select(
'page_touched' )
108 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
109 ->caller( __METHOD__ )->fetchField();
110 if ( $touched ===
false ) {
114 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
117 return $cache->getWithSetCallback(
118 $this->repo->getLocalCacheKey(
119 'file-foreign-description',
124 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
125 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
126 wfDebug(
"Fetching shared description from $renderUrl" );
127 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
128 get( $renderUrl, [], $fname );
130 $ttl = WANObjectCache::TTL_UNCACHEABLE;
146 $dbr = $this->repo->getReplicaDB();
147 $pageId = $dbr->newSelectQueryBuilder()
148 ->select(
'page_id' )
150 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
151 ->caller( __METHOD__ )->fetchField();
153 if ( $pageId !==
false ) {
154 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
155 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') &&MW_ENTRY_POINT !=='cli' $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)
Local file in the wiki's own database.