MediaWiki  1.33.0
Go to the documentation of this file.
1 <?php
29 require_once __DIR__ . '/Maintenance.php';
36 class BackupReader extends Maintenance {
37  public $reportingInterval = 100;
38  public $pageCount = 0;
39  public $revCount = 0;
40  public $dryRun = false;
41  public $uploads = false;
42  protected $uploadCount = 0;
43  public $imageBasePath = false;
44  public $nsFilter = false;
46  function __construct() {
47  parent::__construct();
48  $gz = in_array( 'compress.zlib', stream_get_wrappers() )
49  ? 'ok'
50  : '(disabled; requires PHP zlib module)';
51  $bz2 = in_array( 'compress.bzip2', stream_get_wrappers() )
52  ? 'ok'
53  : '(disabled; requires PHP bzip2 module)';
55  $this->addDescription(
56  <<<TEXT
57 This script reads pages from an XML file as produced from Special:Export or
58 dumpBackup.php, and saves them into the current wiki.
60 Compressed XML files may be read directly:
61  .gz $gz
62  .bz2 $bz2
63  .7z (if 7za executable is in PATH)
65 Note that for very large data sets, importDump.php may be slow; there are
66 alternate methods which can be much faster for full site restoration:
67 <>
69  );
70  $this->stderr = fopen( "php://stderr", "wt" );
71  $this->addOption( 'report',
72  'Report position and speed after every n pages processed', false, true );
73  $this->addOption( 'namespaces',
74  'Import only the pages from namespaces belonging to the list of ' .
75  'pipe-separated namespace names or namespace indexes', false, true );
76  $this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page',
77  false, true );
78  $this->addOption( 'dry-run', 'Parse dump without actually importing pages' );
79  $this->addOption( 'debug', 'Output extra verbose debug information' );
80  $this->addOption( 'uploads', 'Process file upload data if included (experimental)' );
81  $this->addOption(
82  'no-updates',
83  'Disable link table updates. Is faster but leaves the wiki in an inconsistent state'
84  );
85  $this->addOption( 'image-base-path', 'Import files from a specified path', false, true );
86  $this->addOption( 'skip-to', 'Start from nth page by skipping first n-1 pages', false, true );
87  $this->addOption( 'username-prefix', 'Prefix for interwiki usernames', false, true );
88  $this->addOption( 'no-local-users',
89  'Treat all usernames as interwiki. ' .
90  'The default is to assign edits to local users where they exist.',
91  false, false
92  );
93  $this->addArg( 'file', 'Dump file to import [else use stdin]', false );
94  }
96  public function execute() {
97  if ( wfReadOnly() ) {
98  $this->fatalError( "Wiki is in read-only mode; you'll need to disable it for import to work." );
99  }
101  $this->reportingInterval = intval( $this->getOption( 'report', 100 ) );
102  if ( !$this->reportingInterval ) {
103  $this->reportingInterval = 100; // avoid division by zero
104  }
106  $this->dryRun = $this->hasOption( 'dry-run' );
107  $this->uploads = $this->hasOption( 'uploads' ); // experimental!
108  if ( $this->hasOption( 'image-base-path' ) ) {
109  $this->imageBasePath = $this->getOption( 'image-base-path' );
110  }
111  if ( $this->hasOption( 'namespaces' ) ) {
112  $this->setNsfilter( explode( '|', $this->getOption( 'namespaces' ) ) );
113  }
115  if ( $this->hasArg( 0 ) ) {
116  $this->importFromFile( $this->getArg( 0 ) );
117  } else {
118  $this->importFromStdin();
119  }
121  $this->output( "Done!\n" );
122  $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges,\n" );
123  $this->output( "and initSiteStats.php to update page and revision counts\n" );
124  }
127  if ( count( $namespaces ) == 0 ) {
128  $this->nsFilter = false;
130  return;
131  }
132  $this->nsFilter = array_unique( array_map( [ $this, 'getNsIndex' ], $namespaces ) );
133  }
135  private function getNsIndex( $namespace ) {
136  $contLang = MediaWikiServices::getInstance()->getContentLanguage();
137  $result = $contLang->getNsIndex( $namespace );
138  if ( $result !== false ) {
139  return $result;
140  }
141  $ns = intval( $namespace );
142  if ( strval( $ns ) === $namespace && $contLang->getNsText( $ns ) !== false ) {
143  return $ns;
144  }
145  $this->fatalError( "Unknown namespace text / index specified: $namespace" );
146  }
153  private function skippedNamespace( $obj ) {
154  $title = null;
155  if ( $obj instanceof Title ) {
156  $title = $obj;
157  } elseif ( $obj instanceof Revision ) {
158  $title = $obj->getTitle();
159  } elseif ( $obj instanceof WikiRevision ) {
160  $title = $obj->title;
161  } else {
162  throw new MWException( "Cannot get namespace of object in " . __METHOD__ );
163  }
165  if ( is_null( $title ) ) {
166  // Probably a log entry
167  return false;
168  }
170  $ns = $title->getNamespace();
172  return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
173  }
175  function reportPage( $page ) {
176  $this->pageCount++;
177  }
182  function handleRevision( $rev ) {
183  $title = $rev->getTitle();
184  if ( !$title ) {
185  $this->progress( "Got bogus revision with null title!" );
187  return;
188  }
190  if ( $this->skippedNamespace( $title ) ) {
191  return;
192  }
194  $this->revCount++;
195  $this->report();
197  if ( !$this->dryRun ) {
198  call_user_func( $this->importCallback, $rev );
199  }
200  }
206  function handleUpload( $revision ) {
207  if ( $this->uploads ) {
208  if ( $this->skippedNamespace( $revision ) ) {
209  return false;
210  }
211  $this->uploadCount++;
212  // $this->report();
213  $this->progress( "upload: " . $revision->getFilename() );
215  if ( !$this->dryRun ) {
216  // bluuuh hack
217  // call_user_func( $this->uploadCallback, $revision );
218  $dbw = $this->getDB( DB_MASTER );
220  return $dbw->deadlockLoop( [ $revision, 'importUpload' ] );
221  }
222  }
224  return false;
225  }
227  function handleLogItem( $rev ) {
228  if ( $this->skippedNamespace( $rev ) ) {
229  return;
230  }
231  $this->revCount++;
232  $this->report();
234  if ( !$this->dryRun ) {
235  call_user_func( $this->logItemCallback, $rev );
236  }
237  }
239  function report( $final = false ) {
240  if ( $final xor ( $this->pageCount % $this->reportingInterval == 0 ) ) {
241  $this->showReport();
242  }
243  }
245  function showReport() {
246  if ( !$this->mQuiet ) {
247  $delta = microtime( true ) - $this->startTime;
248  if ( $delta ) {
249  $rate = sprintf( "%.2f", $this->pageCount / $delta );
250  $revrate = sprintf( "%.2f", $this->revCount / $delta );
251  } else {
252  $rate = '-';
253  $revrate = '-';
254  }
255  # Logs dumps don't have page tallies
256  if ( $this->pageCount ) {
257  $this->progress( "$this->pageCount ($rate pages/sec $revrate revs/sec)" );
258  } else {
259  $this->progress( "$this->revCount ($revrate revs/sec)" );
260  }
261  }
262  wfWaitForSlaves();
263  }
265  function progress( $string ) {
266  fwrite( $this->stderr, $string . "\n" );
267  }
269  function importFromFile( $filename ) {
270  if ( preg_match( '/\.gz$/', $filename ) ) {
271  $filename = 'compress.zlib://' . $filename;
272  } elseif ( preg_match( '/\.bz2$/', $filename ) ) {
273  $filename = 'compress.bzip2://' . $filename;
274  } elseif ( preg_match( '/\.7z$/', $filename ) ) {
275  $filename = 'mediawiki.compress.7z://' . $filename;
276  }
278  $file = fopen( $filename, 'rt' );
280  return $this->importFromHandle( $file );
281  }
283  function importFromStdin() {
284  $file = fopen( 'php://stdin', 'rt' );
285  if ( self::posix_isatty( $file ) ) {
286  $this->maybeHelp( true );
287  }
289  return $this->importFromHandle( $file );
290  }
292  function importFromHandle( $handle ) {
293  $this->startTime = microtime( true );
295  $source = new ImportStreamSource( $handle );
296  $importer = new WikiImporter( $source, $this->getConfig() );
298  // Updating statistics require a lot of time so disable it
299  $importer->disableStatisticsUpdate();
301  if ( $this->hasOption( 'debug' ) ) {
302  $importer->setDebug( true );
303  }
304  if ( $this->hasOption( 'no-updates' ) ) {
305  $importer->setNoUpdates( true );
306  }
307  if ( $this->hasOption( 'username-prefix' ) ) {
308  $importer->setUsernamePrefix(
309  $this->getOption( 'username-prefix' ),
310  !$this->hasOption( 'no-local-users' )
311  );
312  }
313  if ( $this->hasOption( 'rootpage' ) ) {
314  $statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
315  if ( !$statusRootPage->isGood() ) {
316  // Die here so that it doesn't print "Done!"
317  $this->fatalError( $statusRootPage->getMessage()->text() );
318  return false;
319  }
320  }
321  if ( $this->hasOption( 'skip-to' ) ) {
322  $nthPage = (int)$this->getOption( 'skip-to' );
323  $importer->setPageOffset( $nthPage );
324  $this->pageCount = $nthPage - 1;
325  }
326  $importer->setPageCallback( [ $this, 'reportPage' ] );
327  $importer->setNoticeCallback( function ( $msg, $params ) {
328  echo wfMessage( $msg, $params )->text() . "\n";
329  } );
330  $this->importCallback = $importer->setRevisionCallback(
331  [ $this, 'handleRevision' ] );
332  $this->uploadCallback = $importer->setUploadCallback(
333  [ $this, 'handleUpload' ] );
334  $this->logItemCallback = $importer->setLogItemCallback(
335  [ $this, 'handleLogItem' ] );
336  if ( $this->uploads ) {
337  $importer->setImportUploads( true );
338  }
339  if ( $this->imageBasePath ) {
340  $importer->setImageBasePath( $this->imageBasePath );
341  }
343  if ( $this->dryRun ) {
344  $importer->setPageOutCallback( null );
345  }
347  return $importer->doImport();
348  }
349 }
352 require_once RUN_MAINTENANCE_IF_MAIN;
skippedNamespace( $obj)
Definition: importDump.php:153
Definition: importDump.php:339
XML file reader for the page data importer.
Definition: WikiImporter.php:35
Definition: importDump.php:38
Definition: importDump.php:283
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition: hooks.txt:91
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Definition: router.php:42
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
Default constructor.
Definition: importDump.php:46
maybeHelp( $force=false)
Maybe show the help.
Definition: Maintenance.php:1043
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
Definition: Maintenance.php:485
addDescription( $text)
Set the description text.
Definition: Maintenance.php:329
Definition: importDump.php:43
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. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. '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 '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 '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 '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. '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 IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() '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 Sanitizer::validateEmail(), 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 '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:Array with elements of the form "language:title" in the order that they will be output. & $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. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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
Definition: hooks.txt:1983
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning maintenance scripts have been cleaned up to use a unified class Directory structure How to run a script How to write your own DIRECTORY STRUCTURE The maintenance directory of a MediaWiki installation contains several all of which have unique purposes HOW TO RUN A SCRIPT Ridiculously just call php someScript php that s in the top level maintenance directory if not default wiki
Definition: maintenance.txt:1
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:925
importFromFile( $filename)
Definition: importDump.php:269
Definition: maintenance.txt:50
Definition: styleTest.css.php:44
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1197
handleLogItem( $rev)
Definition: importDump.php:227
setNsfilter(array $namespaces)
Definition: importDump.php:126
hasArg( $argId=0)
Does a given argument exist?
Definition: Maintenance.php:338
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
Definition: hooks.txt:6
Definition: importDump.php:41
Use of locking reads(e.g. the FOR UPDATE clause) is not advised. They are poorly implemented in InnoDB and will cause regular deadlock errors. It 's also surprisingly easy to cripple the wiki with lock contention. Instead of locking reads
This document provides an overview of the usage of PageUpdater and that is
Definition: pageupdater.txt:3
Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
Definition: ImportStreamSource.php:32
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Definition: GlobalFunctions.php:2790
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
Definition: injection.txt:35
The ContentHandler facility adds support for arbitrary content types on wiki pages
Definition: contenthandler.txt:1
handleUpload( $revision)
Definition: importDump.php:206
script(document.cookie)%253c/script%253e</pre ></div > !! end !! test XSS is escaped(inline) !!input< source lang
Definition: importDump.php:245
Definition: Revision.php:40
scripts txt MediaWiki primary scripts are in the root directory of the software Users should only use these scripts to access the wiki There are also some php that aren t primary scripts but helper files and won t work if they are accessed directly by the web Primary see https
Definition: scripts.txt:21
MediaWiki exception.
Definition: MWException.php:26
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
Definition: Maintenance.php:594
reportPage( $page)
Definition: importDump.php:175
Definition: importDump.php:44
Definition: importDump.php:39
has been added to your &Future changes to this page and its associated Talk page will be listed there
Definition: All_system_messages.txt:357
null for the wiki Added in
Definition: hooks.txt:1588
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition files
Definition: COPYING.txt:157
Definition: importDump.php:42
Maintenance script that imports XML dump files into the current wiki.
Definition: importDump.php:36
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Definition: Maintenance.php:248
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
Definition: importDump.php:37
Definition: defines.php:26
Definition: importDump.php:40
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("", 2))
Definition: COPYING.txt:140
importFromHandle( $handle)
Definition: importDump.php:292
getNsIndex( $namespace)
Definition: importDump.php:135
handleRevision( $rev)
Definition: importDump.php:182
wiki Special
Definition: All_system_messages.txt:2667
Represents a title within MediaWiki.
Definition: Title.php:40
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing them
Definition: hooks.txt:979
getOption( $name, $default=null)
Get an option, or return the default.
Definition: Maintenance.php:283
Represents a revision, log entry or upload during the import process.
Definition: WikiRevision.php:37
progress( $string)
Definition: importDump.php:265
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types are
Definition: contenthandler.txt:5
Do the actual work.
Definition: importDump.php:96
report( $final=false)
Definition: importDump.php:239
addArg( $arg, $description, $required=true)
Add some args that are needed.
Definition: Maintenance.php:300
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1769
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
Definition: distributors.txt:9
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
Definition: Maintenance.php:1373
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition: APACHE-LICENSE-2.0.txt:43
Definition: mwdoc-filter.php:46
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:434
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 then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if that
Definition: deferred.txt:11
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
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 MediaWikiServices
Definition: injection.txt:23
hasOption( $name)
Checks to see if a particular option exists.
Definition: Maintenance.php:269
getArg( $argId=0, $default=null)
Get an argument.
Definition: Maintenance.php:352
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt