42 function publish( $srcPath, $flags = 0, array $options = [] ) {
69 function restore( $versions = [], $unsuppress =
false ) {
80 function delete( $reason, $suppress =
false,
$user = null ) {
108 if ( !$this->repo->fetchDescription ) {
113 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
118 $touched = $this->repo->getReplicaDB()->selectField(
123 'page_title' => $this->title->getDBkey()
126 if ( $touched ===
false ) {
130 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
133 return $cache->getWithSetCallback(
134 $this->repo->getLocalCacheKey(
135 'ForeignFileDescription',
140 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
141 function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
142 wfDebug(
"Fetching shared description from $renderUrl\n" );
143 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
144 get( $renderUrl, [], $fname );
146 $ttl = WANObjectCache::TTL_UNCACHEABLE;
162 $dbr = $this->repo->getReplicaDB();
163 $pageId =
$dbr->selectField(
168 'page_title' => $this->title->getDBkey()
172 if ( $pageId !==
false ) {
173 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
174 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.
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.
restore( $versions=[], $unsuppress=false)
recordUpload( $oldver, $desc, $license='', $copyStatus='', $source='', $watch=false, $timestamp=false, User $user=null)
Internationalisation code.
Class to represent a local file in the wiki's own database.
string $timestamp
Upload timestamp.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(!isset( $args[0])) $lang