52 $title = Title::makeTitle(
NS_FILE, $row->img_name );
54 $file->loadFromRow( $row );
93 function restore( $versions = [], $unsuppress =
false ) {
104 function delete( $reason, $suppress =
false, $user = null ) {
132 if ( !$this->repo->fetchDescription ) {
137 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
142 $touched = $this->repo->getReplicaDB()->selectField(
147 'page_title' => $this->title->getDBkey()
150 if ( $touched ===
false ) {
154 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
157 return $cache->getWithSetCallback(
158 $this->repo->getLocalCacheKey(
159 'ForeignFileDescription',
164 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
165 function ( $oldValue, &$ttl,
array &$setOpts ) use ( $renderUrl,
$fname ) {
166 wfDebug(
"Fetching shared description from $renderUrl\n" );
169 $ttl = WANObjectCache::TTL_UNCACHEABLE;
185 $dbr = $this->repo->getReplicaDB();
186 $pageId =
$dbr->selectField(
191 'page_title' => $this->title->getDBkey()
195 if ( $pageId !==
false ) {
196 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
197 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_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
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=[])
static newFromRow( $row, $repo)
Create a ForeignDBFile from a title Do not call this except from inside a repo class.
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)
static newFromTitle( $title, $repo, $unused=null)
static get( $url, $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
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,...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!isset( $args[0])) $lang