55 $file->loadFromRow( $row );
94 function restore( $versions = [], $unsuppress =
false ) {
105 function delete( $reason, $suppress =
false,
$user =
null ) {
133 if ( !$this->repo->fetchDescription ) {
138 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->
getName(),
$lang->getCode() );
143 $touched = $this->repo->getReplicaDB()->selectField(
148 'page_title' => $this->
title->getDBkey()
151 if ( $touched ===
false ) {
155 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
158 return $cache->getWithSetCallback(
159 $this->repo->getLocalCacheKey(
160 'ForeignFileDescription',
165 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
166 function ( $oldValue, &$ttl,
array &$setOpts )
use ( $renderUrl,
$fname ) {
167 wfDebug(
"Fetching shared description from $renderUrl\n" );
170 $ttl = WANObjectCache::TTL_UNCACHEABLE;
186 $dbr = $this->repo->getReplicaDB();
187 $pageId =
$dbr->selectField(
192 'page_title' => $this->
title->getDBkey()
196 if ( $pageId !==
false ) {
197 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
198 if (
$url !==
false ) {
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
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, array $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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
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(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
if(!isset( $args[0])) $lang