Go to the documentation of this file.
60 if ( self::$instance ) {
63 global $wgLocalFileRepo, $wgForeignFileRepos;
64 self::$instance =
new RepoGroup( $wgLocalFileRepo, $wgForeignFileRepos );
74 self::$instance =
null;
125 if ( !$this->reposInitialised ) {
134 if ( empty(
$options[
'ignoreRedirect'] )
139 $dbkey =
$title->getDBkey();
140 if ( $this->
cache->has( $dbkey,
$time, 60 ) ) {
148 # Check the local repo
151 # Check the foreign repos
153 foreach ( $this->foreignRepos
as $repo ) {
161 $image = $image ? $image :
false;
162 # Cache file existence or non-existence
163 if ( $useCache && ( !$image || $image->isCacheable() ) ) {
192 if ( !$this->reposInitialised ) {
197 foreach ( $inputItems
as $item ) {
198 if ( !is_array( $item ) ) {
199 $item =
array(
'title' => $item );
202 if ( $item[
'title'] ) {
203 $items[$item[
'title']->getDBkey()] = $item;
207 $images = $this->localRepo->findFiles( $items,
$flags );
209 foreach ( $this->foreignRepos
as $repo ) {
211 foreach ( $images
as $name => $image ) {
212 unset( $items[
$name] );
215 $images = array_merge( $images, $repo->findFiles( $items,
$flags ) );
227 if ( !$this->reposInitialised ) {
231 $redir = $this->localRepo->checkRedirect(
$title );
236 foreach ( $this->foreignRepos
as $repo ) {
237 $redir = $repo->checkRedirect(
$title );
255 if ( !$this->reposInitialised ) {
261 foreach ( $this->foreignRepos
as $repo ) {
279 if ( !$this->reposInitialised ) {
284 foreach ( $this->foreignRepos
as $repo ) {
287 usort(
$result,
'File::compare' );
299 if ( !$this->reposInitialised ) {
304 foreach ( $this->foreignRepos
as $repo ) {
321 if ( !$this->reposInitialised ) {
324 if ( $index ===
'local' ) {
326 } elseif ( isset( $this->foreignRepos[$index] ) ) {
327 return $this->foreignRepos[$index];
339 if ( !$this->reposInitialised ) {
342 foreach ( $this->foreignRepos
as $repo ) {
343 if ( $repo->name ==
$name ) {
358 return $this->
getRepo(
'local' );
370 foreach ( $this->foreignRepos
as $repo ) {
372 if ( call_user_func_array( $callback,
$args ) ) {
392 if ( $this->reposInitialised ) {
395 $this->reposInitialised =
true;
397 $this->localRepo = $this->
newRepo( $this->localInfo );
398 $this->foreignRepos =
array();
399 foreach ( $this->foreignInfo
as $key => $info ) {
400 $this->foreignRepos[$key] = $this->
newRepo( $info );
407 protected function newRepo( $info ) {
408 $class = $info[
'class'];
410 return new $class( $info );
420 if ( substr( $url, 0, 9 ) !=
'mwrepo://' ) {
421 throw new MWException( __METHOD__ .
': unknown protocol' );
424 $bits = explode(
'/', substr( $url, 9 ), 3 );
425 if ( count( $bits ) != 3 ) {
426 throw new MWException( __METHOD__ .
": invalid mwrepo URL: $url" );
439 if ( $repoName ===
'' ) {
442 $repo = $this->
getRepo( $repoName );
444 return $repo->getFileProps( $fileName );
456 $this->
cache->clear();
findFiles(array $inputItems, $flags=0)
Search repositories for many files at once.
hasForeignRepos()
Does the installation have any foreign repos set up?
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
see documentation in includes Linker php for Linker::makeImageLink & $time
static singleton()
Get a RepoGroup instance.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static getPropsFromPath( $path, $ext=true)
Get an associative array containing information about a file in the local filesystem.
findFile( $title, $options=array())
Search repositories for an image.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
you have access to all of the normal MediaWiki so you can get a DB use the cache
__construct( $localInfo, $foreignInfo)
Construct a group of file repositories.
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
findBySha1s(array $hashes)
Find all instances of files with this keys.
Base class for file repositories.
clearCache(Title $title=null)
Clear RepoGroup process cache used for finding a file.
const MAX_CACHE_SIZE
Maximum number of cache items.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
splitVirtualUrl( $url)
Split a virtual URL into repo, zone and rel parts.
when a variable name is used in a it is silently declared as a new masking the global
initialiseRepos()
Initialise the $repos array.
newRepo( $info)
Create a repo class based on an info structure.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
static destroySingleton()
Destroy the singleton instance, so that a new one will be created next time singleton() is called.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
getLocalRepo()
Get the local repository, i.e.
findFileFromKey( $hash, $options=array())
Find an instance of the file with this key, created at the specified time Returns false if the file d...
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
if(PHP_SAPI !='cli') $file
Represents a title within MediaWiki.
findBySha1( $hash)
Find all instances of files with this key.
forEachForeignRepo( $callback, $params=array())
Call a function for each foreign repo, with the repo object as the first parameter.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static isVirtualUrl( $url)
Determine if a string is an mwrepo:// URL.
Prioritized list of file repositories.
getRepoByName( $name)
Get the repo instance by its name.
checkRedirect(Title $title)
Interface for FileRepo::checkRedirect()
getRepo( $index)
Get the repo instance with a given key.
Handles per process caching of items.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
static setSingleton( $instance)
Set the singleton instance to a given object Used by extensions which hook into the Repo chain.