49 public function publish( $srcPath, $flags = 0, array $options = [] ) {
59 public function restore( $versions = [], $unsuppress =
false ) {
79 public function move( $target ) {
98 if ( !$this->repo->fetchDescription ) {
103 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
108 $touched = $this->repo->getReplicaDB()->selectField(
113 'page_title' => $this->title->getDBkey()
117 if ( $touched ===
false ) {
121 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
124 return $cache->getWithSetCallback(
125 $this->repo->getLocalCacheKey(
126 'file-foreign-description',
131 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
132 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
133 wfDebug(
"Fetching shared description from $renderUrl" );
134 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
135 get( $renderUrl, [], $fname );
137 $ttl = WANObjectCache::TTL_UNCACHEABLE;
153 $dbr = $this->repo->getReplicaDB();
154 $pageId =
$dbr->selectField(
159 'page_title' => $this->title->getDBkey()
164 if ( $pageId !==
false ) {
165 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
166 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.
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, UserIdentity $user, $suppress=false)
restore( $versions=[], $unsuppress=false)
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.
UserIdentity null $user
Uploader.
if(!isset( $args[0])) $lang