Go to the documentation of this file.
56 if ( isset( $row->img_name ) ) {
57 return call_user_func( $this->fileFromRowFactory, $row, $this );
58 } elseif ( isset( $row->oi_name ) ) {
59 return call_user_func( $this->oldFileFromRowFactory, $row, $this );
61 throw new MWException( __METHOD__ .
': invalid row' );
89 $storageKeys = array_unique( $storageKeys );
90 foreach ( $storageKeys
as $key ) {
92 $path =
"$root/$hashPath$key";
93 $dbw->begin( __METHOD__ );
98 if ( !$deleted && !$hidden ) {
99 wfDebug( __METHOD__ .
": deleting $key\n" );
100 $op =
array(
'op' =>
'delete',
'src' =>
$path );
102 $status->error(
'undelete-cleanup-error',
$path );
103 $status->failCount++;
106 wfDebug( __METHOD__ .
": $key still in use\n" );
107 $status->successCount++;
109 $dbw->commit( __METHOD__ );
127 return (
bool)$dbw->selectField(
'filearchive',
'1',
128 array(
'fa_storage_group' =>
'deleted',
'fa_storage_key' => $key ),
148 return (
bool)$dbw->selectField(
'oldimage',
'1',
149 array(
'oi_sha1' => $sha1,
150 'oi_archive_name ' . $dbw->buildLike( $dbw->anyString(),
".$ext" ),
163 return strtok( $key,
'.' );
178 if ( $memcKey ===
false ) {
184 $cachedValue =
$wgMemc->get( $memcKey );
185 if ( $cachedValue ===
' ' || $cachedValue ===
'' ) {
188 } elseif ( strval( $cachedValue ) !==
'' && $cachedValue !==
' PURGED' ) {
194 $wgMemc->add( $memcKey,
" ", $expiry );
199 $row =
$dbr->selectRow(
201 array(
'rd_title',
'rd_namespace' ),
202 array(
'rd_from' => $id ),
206 if ( $row && $row->rd_namespace ==
NS_FILE ) {
208 $wgMemc->add( $memcKey, $targetTitle->getDBkey(), $expiry );
212 $wgMemc->add( $memcKey,
'', $expiry );
230 $id =
$dbr->selectField(
234 'page_namespace' =>
$title->getNamespace(),
235 'page_title' =>
$title->getDBkey(),
244 $finalFiles =
array();
246 $searchSet =
array();
247 foreach ( $items
as $item ) {
248 if ( is_array( $item ) ) {
251 $searchSet[
$title->getDBkey()] = $item;
263 $user = ( !empty( $search[
'private'] ) && $search[
'private'] instanceof
User )
270 ( empty( $search[
'time'] ) && !
$file->isOld() ) ||
271 ( !empty( $search[
'time'] ) && $search[
'time'] ===
$file->getTimestamp() )
280 use ( $repo, $fileMatchesSearch,
$flags )
283 $info = $repo->getInfo();
284 foreach (
$res as $row ) {
285 $file = $repo->newFileFromRow( $row );
288 $dbKeysLook =
array( str_replace(
' ',
'_',
$file->getName() ) );
289 if ( !empty( $info[
'initialCapital'] ) ) {
293 foreach ( $dbKeysLook
as $dbKey ) {
294 if ( isset( $searchSet[$dbKey] )
295 && $fileMatchesSearch(
$file, $searchSet[$dbKey] )
298 ?
array(
'title' => $dbKey,
'timestamp' =>
$file->getTimestamp() )
300 unset( $searchSet[$dbKey] );
310 foreach ( array_keys( $searchSet )
as $dbKey ) {
314 if ( count( $imgNames ) ) {
317 $applyMatchingFiles(
$res, $searchSet, $finalFiles );
322 foreach ( $searchSet
as $dbKey => $search ) {
323 if ( isset( $search[
'time'] ) ) {
324 $oiConds[] =
$dbr->makeList(
327 'oi_timestamp' =>
$dbr->timestamp( $search[
'time'] )
334 if ( count( $oiConds ) ) {
337 $applyMatchingFiles(
$res, $searchSet, $finalFiles );
341 foreach ( $searchSet
as $dbKey => $search ) {
342 if ( !empty( $search[
'ignoreRedirect'] ) ) {
349 if ( $redir && $redir->getNamespace() ==
NS_FILE ) {
351 if (
$file && $fileMatchesSearch(
$file, $search ) ) {
354 $finalFiles[$dbKey] =
array(
355 'title' =>
$file->getTitle()->getDBkey(),
356 'timestamp' =>
$file->getTimestamp()
359 $finalFiles[$dbKey] =
$file;
382 array(
'ORDER BY' =>
'img_name' )
386 foreach (
$res as $row ) {
414 array(
'ORDER BY' =>
'img_name' )
418 foreach (
$res as $row ) {
435 $selectOptions =
array(
'ORDER BY' =>
'img_name',
'LIMIT' => intval(
$limit ) );
442 'img_name ' .
$dbr->buildLike( $prefix,
$dbr->anyString() ),
449 foreach (
$res as $row ) {
480 $args = func_get_args();
482 return call_user_func_array(
'wfMemcKey',
$args );
499 $wgMemc->set( $memcKey,
' PURGED', 12 );
512 return array_merge( parent::getInfo(),
array(
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getInfo()
Return information about the repository.
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
newGood( $value=null)
Create a new good result.
getMasterDB()
Get a connection to the master DB.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
doOperation(array $op, array $opts=array())
Same as doOperations() except it takes a single operation.
deletedFileHasKey( $key, $lock=null)
Check if a deleted (filearchive) file has this sha1 key.
getZonePath( $zone)
Get the storage path corresponding to one of the zones.
static selectFields()
Fields in the oldimage table.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
it s the revision text itself In either if gzip is the revision text is gzipped $flags
hiddenFileHasKey( $key, $lock=null)
Check if a hidden (revision delete) file has this sha1 key.
static getHashFromKey( $key)
Gets the SHA1 hash from a storage key.
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
Base class for file repositories.
static normalizeExtension( $ext)
Normalize a file extension to the common form, and ensure it's clean.
Implements some public methods and some protected utility functions which are required by multiple ch...
newFile( $title, $time=false)
Create a new File object from the local repository.
getSlaveDB()
Get a connection to the slave DB.
array $oldFileFromRowFactory
invalidateImageRedirect(Title $title)
Invalidates image redirect cache related to that image.
getArticleID( $title)
Function link Title::getArticleID().
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
findFiles(array $items, $flags=0)
Find many files at once.
getNameFromTitle(Title $title)
Get the name of a file from its title object.
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
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
presenting them properly to the user as errors is done by the caller $title
newFromArchiveName( $title, $archiveName)
findBySha1s(array $hashes)
Get an array of arrays or iterators of file objects for files that have the given SHA-1 content hashe...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
getLocalCacheKey()
Get a key for this repo in the local cache domain.
findFilesByPrefix( $prefix, $limit)
Return an array of files where the name starts with $prefix.
checkRedirect(Title $title)
Checks if there is a redirect named as $title.
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
static selectFields()
Fields in the image table.
Represents a title within MediaWiki.
cleanupDeletedBatch(array $storageKeys)
Delete files in the deleted directory if they are not referenced in the filearchive table.
getSharedCacheKey()
Get a key on the primary cache for this repository.
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
findBySha1( $hash)
Get an array or iterator of file objects for files that have a given SHA-1 content hash.
array $fileFromRowFactory
static newFromArchiveName( $title, $repo, $archiveName)
getDeletedHashPath( $key)
Get a relative path for a deletion archive key, e.g.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
Result wrapper for grabbing data queried by someone else.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.