MediaWiki  1.29.1
importDump.php
Go to the documentation of this file.
1 <?php
27 require_once __DIR__ . '/Maintenance.php';
28 
34 class BackupReader extends Maintenance {
35  public $reportingInterval = 100;
36  public $pageCount = 0;
37  public $revCount = 0;
38  public $dryRun = false;
39  public $uploads = false;
40  public $imageBasePath = false;
41  public $nsFilter = false;
42 
43  function __construct() {
44  parent::__construct();
45  $gz = in_array( 'compress.zlib', stream_get_wrappers() )
46  ? 'ok'
47  : '(disabled; requires PHP zlib module)';
48  $bz2 = in_array( 'compress.bzip2', stream_get_wrappers() )
49  ? 'ok'
50  : '(disabled; requires PHP bzip2 module)';
51 
52  $this->addDescription(
53  <<<TEXT
54 This script reads pages from an XML file as produced from Special:Export or
55 dumpBackup.php, and saves them into the current wiki.
56 
57 Compressed XML files may be read directly:
58  .gz $gz
59  .bz2 $bz2
60  .7z (if 7za executable is in PATH)
61 
62 Note that for very large data sets, importDump.php may be slow; there are
63 alternate methods which can be much faster for full site restoration:
64 <https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps>
65 TEXT
66  );
67  $this->stderr = fopen( "php://stderr", "wt" );
68  $this->addOption( 'report',
69  'Report position and speed after every n pages processed', false, true );
70  $this->addOption( 'namespaces',
71  'Import only the pages from namespaces belonging to the list of ' .
72  'pipe-separated namespace names or namespace indexes', false, true );
73  $this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page',
74  false, true );
75  $this->addOption( 'dry-run', 'Parse dump without actually importing pages' );
76  $this->addOption( 'debug', 'Output extra verbose debug information' );
77  $this->addOption( 'uploads', 'Process file upload data if included (experimental)' );
78  $this->addOption(
79  'no-updates',
80  'Disable link table updates. Is faster but leaves the wiki in an inconsistent state'
81  );
82  $this->addOption( 'image-base-path', 'Import files from a specified path', false, true );
83  $this->addArg( 'file', 'Dump file to import [else use stdin]', false );
84  }
85 
86  public function execute() {
87  if ( wfReadOnly() ) {
88  $this->error( "Wiki is in read-only mode; you'll need to disable it for import to work.", true );
89  }
90 
91  $this->reportingInterval = intval( $this->getOption( 'report', 100 ) );
92  if ( !$this->reportingInterval ) {
93  $this->reportingInterval = 100; // avoid division by zero
94  }
95 
96  $this->dryRun = $this->hasOption( 'dry-run' );
97  $this->uploads = $this->hasOption( 'uploads' ); // experimental!
98  if ( $this->hasOption( 'image-base-path' ) ) {
99  $this->imageBasePath = $this->getOption( 'image-base-path' );
100  }
101  if ( $this->hasOption( 'namespaces' ) ) {
102  $this->setNsfilter( explode( '|', $this->getOption( 'namespaces' ) ) );
103  }
104 
105  if ( $this->hasArg() ) {
106  $this->importFromFile( $this->getArg() );
107  } else {
108  $this->importFromStdin();
109  }
110 
111  $this->output( "Done!\n" );
112  $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges,\n" );
113  $this->output( "and initSiteStats.php to update page and revision counts\n" );
114  }
115 
117  if ( count( $namespaces ) == 0 ) {
118  $this->nsFilter = false;
119 
120  return;
121  }
122  $this->nsFilter = array_unique( array_map( [ $this, 'getNsIndex' ], $namespaces ) );
123  }
124 
125  private function getNsIndex( $namespace ) {
127  $result = $wgContLang->getNsIndex( $namespace );
128  if ( $result !== false ) {
129  return $result;
130  }
131  $ns = intval( $namespace );
132  if ( strval( $ns ) === $namespace && $wgContLang->getNsText( $ns ) !== false ) {
133  return $ns;
134  }
135  $this->error( "Unknown namespace text / index specified: $namespace", true );
136  }
137 
142  private function skippedNamespace( $obj ) {
143  $title = null;
144  if ( $obj instanceof Title ) {
145  $title = $obj;
146  } elseif ( $obj instanceof Revision ) {
147  $title = $obj->getTitle();
148  } elseif ( $obj instanceof WikiRevision ) {
149  $title = $obj->title;
150  } else {
151  throw new MWException( "Cannot get namespace of object in " . __METHOD__ );
152  }
153 
154  if ( is_null( $title ) ) {
155  // Probably a log entry
156  return false;
157  }
158 
159  $ns = $title->getNamespace();
160 
161  return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
162  }
163 
164  function reportPage( $page ) {
165  $this->pageCount++;
166  }
167 
171  function handleRevision( $rev ) {
172  $title = $rev->getTitle();
173  if ( !$title ) {
174  $this->progress( "Got bogus revision with null title!" );
175 
176  return;
177  }
178 
179  if ( $this->skippedNamespace( $title ) ) {
180  return;
181  }
182 
183  $this->revCount++;
184  $this->report();
185 
186  if ( !$this->dryRun ) {
187  call_user_func( $this->importCallback, $rev );
188  }
189  }
190 
195  function handleUpload( $revision ) {
196  if ( $this->uploads ) {
197  if ( $this->skippedNamespace( $revision ) ) {
198  return false;
199  }
200  $this->uploadCount++;
201  // $this->report();
202  $this->progress( "upload: " . $revision->getFilename() );
203 
204  if ( !$this->dryRun ) {
205  // bluuuh hack
206  // call_user_func( $this->uploadCallback, $revision );
207  $dbw = $this->getDB( DB_MASTER );
208 
209  return $dbw->deadlockLoop( [ $revision, 'importUpload' ] );
210  }
211  }
212 
213  return false;
214  }
215 
216  function handleLogItem( $rev ) {
217  if ( $this->skippedNamespace( $rev ) ) {
218  return;
219  }
220  $this->revCount++;
221  $this->report();
222 
223  if ( !$this->dryRun ) {
224  call_user_func( $this->logItemCallback, $rev );
225  }
226  }
227 
228  function report( $final = false ) {
229  if ( $final xor ( $this->pageCount % $this->reportingInterval == 0 ) ) {
230  $this->showReport();
231  }
232  }
233 
234  function showReport() {
235  if ( !$this->mQuiet ) {
236  $delta = microtime( true ) - $this->startTime;
237  if ( $delta ) {
238  $rate = sprintf( "%.2f", $this->pageCount / $delta );
239  $revrate = sprintf( "%.2f", $this->revCount / $delta );
240  } else {
241  $rate = '-';
242  $revrate = '-';
243  }
244  # Logs dumps don't have page tallies
245  if ( $this->pageCount ) {
246  $this->progress( "$this->pageCount ($rate pages/sec $revrate revs/sec)" );
247  } else {
248  $this->progress( "$this->revCount ($revrate revs/sec)" );
249  }
250  }
251  wfWaitForSlaves();
252  }
253 
254  function progress( $string ) {
255  fwrite( $this->stderr, $string . "\n" );
256  }
257 
258  function importFromFile( $filename ) {
259  if ( preg_match( '/\.gz$/', $filename ) ) {
260  $filename = 'compress.zlib://' . $filename;
261  } elseif ( preg_match( '/\.bz2$/', $filename ) ) {
262  $filename = 'compress.bzip2://' . $filename;
263  } elseif ( preg_match( '/\.7z$/', $filename ) ) {
264  $filename = 'mediawiki.compress.7z://' . $filename;
265  }
266 
267  $file = fopen( $filename, 'rt' );
268 
269  return $this->importFromHandle( $file );
270  }
271 
272  function importFromStdin() {
273  $file = fopen( 'php://stdin', 'rt' );
274  if ( self::posix_isatty( $file ) ) {
275  $this->maybeHelp( true );
276  }
277 
278  return $this->importFromHandle( $file );
279  }
280 
281  function importFromHandle( $handle ) {
282  $this->startTime = microtime( true );
283 
284  $source = new ImportStreamSource( $handle );
285  $importer = new WikiImporter( $source, $this->getConfig() );
286 
287  // Updating statistics require a lot of time so disable it
288  $importer->disableStatisticsUpdate();
289 
290  if ( $this->hasOption( 'debug' ) ) {
291  $importer->setDebug( true );
292  }
293  if ( $this->hasOption( 'no-updates' ) ) {
294  $importer->setNoUpdates( true );
295  }
296  if ( $this->hasOption( 'rootpage' ) ) {
297  $statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
298  if ( !$statusRootPage->isGood() ) {
299  // Die here so that it doesn't print "Done!"
300  $this->error( $statusRootPage->getMessage()->text(), 1 );
301  return false;
302  }
303  }
304  $importer->setPageCallback( [ $this, 'reportPage' ] );
305  $this->importCallback = $importer->setRevisionCallback(
306  [ $this, 'handleRevision' ] );
307  $this->uploadCallback = $importer->setUploadCallback(
308  [ $this, 'handleUpload' ] );
309  $this->logItemCallback = $importer->setLogItemCallback(
310  [ $this, 'handleLogItem' ] );
311  if ( $this->uploads ) {
312  $importer->setImportUploads( true );
313  }
314  if ( $this->imageBasePath ) {
315  $importer->setImageBasePath( $this->imageBasePath );
316  }
317 
318  if ( $this->dryRun ) {
319  $importer->setPageOutCallback( null );
320  }
321 
322  return $importer->doImport();
323  }
324 }
325 
326 $maintClass = 'BackupReader';
327 require_once RUN_MAINTENANCE_IF_MAIN;
BackupReader\skippedNamespace
skippedNamespace( $obj)
Definition: importDump.php:142
$maintClass
$maintClass
Definition: importDump.php:314
WikiImporter
XML file reader for the page data importer.
Definition: WikiImporter.php:34
BackupReader\$pageCount
$pageCount
Definition: importDump.php:36
BackupReader\importFromStdin
importFromStdin()
Definition: importDump.php:272
file
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:93
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:189
BackupReader\__construct
__construct()
Default constructor.
Definition: importDump.php:43
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
Maintenance\maybeHelp
maybeHelp( $force=false)
Maybe show the help.
Definition: Maintenance.php:952
captcha-old.count
count
Definition: captcha-old.py:225
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:287
BackupReader\$imageBasePath
$imageBasePath
Definition: importDump.php:40
$result
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 '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. '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) '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 '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: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! 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:1954
wiki
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
$namespaces
namespace and then decline to actually register it & $namespaces
Definition: hooks.txt:934
BackupReader\importFromFile
importFromFile( $filename)
Definition: importDump.php:258
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1277
BackupReader\handleLogItem
handleLogItem( $rev)
Definition: importDump.php:216
BackupReader\setNsfilter
setNsfilter(array $namespaces)
Definition: importDump.php:116
Maintenance\hasArg
hasArg( $argId=0)
Does a given argument exist?
Definition: Maintenance.php:296
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
BackupReader\$uploads
$uploads
Definition: importDump.php:39
reads
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
ImportStreamSource
Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
Definition: ImportStreamSource.php:32
wfWaitForSlaves
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Definition: GlobalFunctions.php:3214
php
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
pages
The ContentHandler facility adds support for arbitrary content types on wiki pages
Definition: contenthandler.txt:1
BackupReader\handleUpload
handleUpload( $revision)
Definition: importDump.php:195
BackupReader\showReport
showReport()
Definition: importDump.php:234
Revision
Definition: Revision.php:33
MWException
MediaWiki exception.
Definition: MWException.php:26
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
Maintenance\getConfig
getConfig()
Definition: Maintenance.php:504
BackupReader\reportPage
reportPage( $page)
Definition: importDump.php:164
BackupReader\$nsFilter
$nsFilter
Definition: importDump.php:41
script
script(document.cookie)%253c/script%253e</pre ></div > !! end !! test XSS is escaped(inline) !!input< source lang
BackupReader\$revCount
$revCount
Definition: importDump.php:37
there
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
$page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
Definition: hooks.txt:2536
in
null for the wiki Added in
Definition: hooks.txt:1572
directly
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as etc Revision Encapsulates individual page revision data and access to the revision text blobs storage system Higher level code should never touch text storage directly
Definition: design.txt:34
files
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
BackupReader
Maintenance script that imports XML dump files into the current wiki.
Definition: importDump.php:34
Maintenance\addOption
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Definition: Maintenance.php:215
Note
this hook is for auditing only RecentChangesLinked and Watchlist 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 you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers Note
Definition: hooks.txt:1049
BackupReader\$reportingInterval
$reportingInterval
Definition: importDump.php:35
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
DB_MASTER
const DB_MASTER
Definition: defines.php:26
BackupReader\$dryRun
$dryRun
Definition: importDump.php:38
or
or
Definition: COPYING.txt:140
BackupReader\importFromHandle
importFromHandle( $handle)
Definition: importDump.php:281
BackupReader\getNsIndex
getNsIndex( $namespace)
Definition: importDump.php:125
BackupReader\handleRevision
handleRevision( $rev)
Definition: importDump.php:171
Special
wiki Special
Definition: All_system_messages.txt:2667
Title
Represents a title within MediaWiki.
Definition: Title.php:39
and
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
Maintenance\getOption
getOption( $name, $default=null)
Get an option, or return the default.
Definition: Maintenance.php:250
WikiRevision
Represents a revision, log entry or upload during the import process.
Definition: WikiRevision.php:35
BackupReader\progress
progress( $string)
Definition: importDump.php:254
are
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
BackupReader\execute
execute()
Do the actual work.
Definition: importDump.php:86
https
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at https
Definition: design.txt:12
BackupReader\report
report( $final=false)
Definition: importDump.php:228
Maintenance\addArg
addArg( $arg, $description, $required=true)
Add some args that are needed.
Definition: Maintenance.php:267
$rev
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:1741
as
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
Maintenance\getDB
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
Definition: Maintenance.php:1251
from
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
$source
$source
Definition: mwdoc-filter.php:45
Maintenance\error
error( $err, $die=0)
Throw an error to the user.
Definition: Maintenance.php:392
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:373
that
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
Maintenance\hasOption
hasOption( $name)
Checks to see if a particular param exists.
Definition: Maintenance.php:236
Maintenance\getArg
getArg( $argId=0, $default=null)
Get an argument.
Definition: Maintenance.php:306
data
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
array
the array() calling protocol came about after MediaWiki 1.4rc1.
$wgContLang
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
Definition: design.txt:56
them
this hook is for auditing only RecentChangesLinked and Watchlist 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:990