MediaWiki  1.29.1
cleanupInvalidDbKeys.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
25 
34  protected static $tables = [
35  // Data tables
36  [ 'page', 'page' ],
37  [ 'redirect', 'rd', 'idField' => 'rd_from' ],
38  [ 'archive', 'ar' ],
39  [ 'logging', 'log' ],
40  [ 'protected_titles', 'pt', 'idField' => 0 ],
41  [ 'category', 'cat', 'nsField' => 14 ],
42  [ 'recentchanges', 'rc' ],
43  [ 'watchlist', 'wl' ],
44  // The querycache tables' qc(c)_title and qcc_titletwo may contain titles,
45  // but also usernames or other things like that, so we leave them alone
46 
47  // Links tables
48  [ 'pagelinks', 'pl', 'idField' => 'pl_from' ],
49  [ 'templatelinks', 'tl', 'idField' => 'tl_from' ],
50  [ 'categorylinks', 'cl', 'idField' => 'cl_from', 'nsField' => 14, 'titleField' => 'cl_to' ],
51  ];
52 
53  public function __construct() {
54  parent::__construct();
55  $this->addDescription( <<<'TEXT'
56 This script cleans up the title fields in various tables to remove entries that
57 will be rejected by the constructor of TitleValue. This constructor throws an
58 exception when invalid data is encountered, which will not normally occur on
59 regular page views, but can happen on query special pages.
60 
61 The script targets titles matching the regular expression /^_|[ \r\n\t]|_$/.
62 Because any foreign key relationships involving these titles will already be
63 broken, the titles are corrected to a valid version or the rows are deleted
64 entirely, depending on the table.
65 
66 Key progress output is printed to STDERR, while a full log of all entries that
67 are deleted is sent to STDOUT. You are strongly advised to capture STDOUT into
68 a file.
69 TEXT
70  );
71  $this->addOption( 'fix', 'Actually clean up invalid titles. If this parameter is ' .
72  'not specified, the script will report invalid titles but not clean them up.',
73  false, false );
74  $this->addOption( 'table', 'The table(s) to process. This option can be specified ' .
75  'more than once (e.g. -t category -t watchlist). If not specified, all available ' .
76  'tables will be processed. Available tables are: ' .
77  implode( ', ', array_column( static::$tables, 0 ) ), false, true, 't', true );
78 
79  $this->setBatchSize( 500 );
80  }
81 
82  public function execute() {
83  $tablesToProcess = $this->getOption( 'table' );
84  foreach ( static::$tables as $tableParams ) {
85  if ( !$tablesToProcess || in_array( $tableParams[0], $tablesToProcess ) ) {
86  $this->cleanupTable( $tableParams );
87  }
88  }
89 
90  $this->output( 'Done! Cleaned up invalid DB keys on ' . wfWikiID() . "!\n" );
91  }
92 
100  protected function output( $str, $channel = null ) {
101  // Make it easier to find progress lines in the STDOUT log
102  if ( trim( $str ) ) {
103  fwrite( STDOUT, '*** ' );
104  }
105  fwrite( STDERR, $str );
106  }
107 
113  protected function writeToReport( $str ) {
114  fwrite( STDOUT, $str );
115  }
116 
122  protected function cleanupTable( $tableParams ) {
123  $table = $tableParams[0];
124  $prefix = $tableParams[1];
125  $idField = isset( $tableParams['idField'] ) ?
126  $tableParams['idField'] :
127  "{$prefix}_id";
128  $nsField = isset( $tableParams['nsField'] ) ?
129  $tableParams['nsField'] :
130  "{$prefix}_namespace";
131  $titleField = isset( $tableParams['titleField'] ) ?
132  $tableParams['titleField'] :
133  "{$prefix}_title";
134 
135  $this->output( "Looking for invalid $titleField entries in $table...\n" );
136 
137  // Do all the select queries on the replicas, as they are slow (they use
138  // unanchored LIKEs). Naturally this could cause problems if rows are
139  // modified after selecting and before deleting/updating, but working on
140  // the hypothesis that invalid rows will be old and in all likelihood
141  // unreferenced, we should be fine to do it like this.
142  $dbr = $this->getDB( DB_REPLICA, 'vslow' );
143 
144  // Find all TitleValue-invalid titles.
145  $percent = $dbr->anyString(); // DBMS-agnostic equivalent of '%' LIKE wildcard
146  $res = $dbr->select(
147  $table,
148  [
149  'id' => $idField,
150  'ns' => $nsField,
151  'title' => $titleField,
152  ],
153  // The REGEXP operator is not cross-DBMS, so we have to use lots of LIKEs
154  [ $dbr->makeList( [
155  $titleField . $dbr->buildLike( $percent, ' ', $percent ),
156  $titleField . $dbr->buildLike( $percent, '\r', $percent ),
157  $titleField . $dbr->buildLike( $percent, '\n', $percent ),
158  $titleField . $dbr->buildLike( $percent, '\t', $percent ),
159  $titleField . $dbr->buildLike( '_', $percent ),
160  $titleField . $dbr->buildLike( $percent, '_' ),
161  ], LIST_OR ) ],
162  __METHOD__,
163  [ 'LIMIT' => $this->mBatchSize ]
164  );
165 
166  $this->output( "Number of invalid rows: " . $res->numRows() . "\n" );
167  if ( !$res->numRows() ) {
168  $this->output( "\n" );
169  return;
170  }
171 
172  // Write a table of titles to the report file. Also keep a list of the found
173  // IDs, as we might need it later for DB updates
174  $this->writeToReport( sprintf( "%10s | ns | dbkey\n", $idField ) );
175  $ids = [];
176  foreach ( $res as $row ) {
177  $this->writeToReport( sprintf( "%10d | %3d | %s\n", $row->id, $row->ns, $row->title ) );
178  $ids[] = $row->id;
179  }
180 
181  // If we're doing a dry run, output the new titles we would use for the UPDATE
182  // queries (if relevant), and finish
183  if ( !$this->hasOption( 'fix' ) ) {
184  if ( $table === 'logging' || $table === 'archive' ) {
185  $this->writeToReport( "The following updates would be run with the --fix flag:\n" );
186  foreach ( $res as $row ) {
187  $newTitle = self::makeValidTitle( $row->title );
188  $this->writeToReport(
189  "$idField={$row->id}: update '{$row->title}' to '$newTitle'\n" );
190  }
191  }
192 
193  if ( $table !== 'page' && $table !== 'redirect' ) {
194  $this->output( "Run with --fix to clean up these rows\n" );
195  }
196  $this->output( "\n" );
197  return;
198  }
199 
200  // Fix the bad data, using different logic for the various tables
201  $dbw = $this->getDB( DB_MASTER );
202  switch ( $table ) {
203  case 'page':
204  case 'redirect':
205  // This shouldn't happen on production wikis, and we already have a script
206  // to handle 'page' rows anyway, so just notify the user and let them decide
207  // what to do next.
208  $this->output( <<<TEXT
209 IMPORTANT: This script does not fix invalid entries in the $table table.
210 Consider repairing these rows, and rows in related tables, by hand.
211 You may like to run, or borrow logic from, the cleanupTitles.php script.
212 
213 TEXT
214  );
215  break;
216 
217  case 'archive':
218  case 'logging':
219  // Rename the title to a corrected equivalent. Any foreign key relationships
220  // to the page_title field are already broken, so this will just make sure
221  // users can still access the log entries/deleted revisions from the interface
222  // using a valid page title.
223  $this->output(
224  "Updating these rows, setting $titleField to the closest valid DB key...\n" );
225  $affectedRowCount = 0;
226  foreach ( $res as $row ) {
227  $newTitle = self::makeValidTitle( $row->title );
228  $this->writeToReport(
229  "$idField={$row->id}: updating '{$row->title}' to '$newTitle'\n" );
230 
231  $dbw->update( $table,
232  [ $titleField => $newTitle ],
233  [ $idField => $row->id ],
234  __METHOD__ );
235  $affectedRowCount += $dbw->affectedRows();
236  }
237  wfWaitForSlaves();
238  $this->output( "Updated $affectedRowCount rows on $table.\n" );
239 
240  break;
241 
242  case 'recentchanges':
243  case 'watchlist':
244  case 'category':
245  // Since these broken titles can't exist, there's really nothing to watch,
246  // nothing can be categorised in them, and they can't have been changed
247  // recently, so we can just remove these rows.
248  $this->output( "Deleting invalid $table rows...\n" );
249  $dbw->delete( $table, [ $idField => $ids ], __METHOD__ );
250  wfWaitForSlaves();
251  $this->output( 'Deleted ' . $dbw->affectedRows() . " rows from $table.\n" );
252  break;
253 
254  case 'protected_titles':
255  // Since these broken titles can't exist, there's really nothing to protect,
256  // so we can just remove these rows. Made more complicated by this table
257  // not having an ID field
258  $this->output( "Deleting invalid $table rows...\n" );
259  $affectedRowCount = 0;
260  foreach ( $res as $row ) {
261  $dbw->delete( $table,
262  [ $nsField => $row->ns, $titleField => $row->title ],
263  __METHOD__ );
264  $affectedRowCount += $dbw->affectedRows();
265  }
266  wfWaitForSlaves();
267  $this->output( "Deleted $affectedRowCount rows from $table.\n" );
268  break;
269 
270  case 'pagelinks':
271  case 'templatelinks':
272  case 'categorylinks':
273  // Update links tables for each page where these bogus links are supposedly
274  // located. If the invalid rows don't go away after these jobs go through,
275  // they're probably being added by a buggy hook.
276  $this->output( "Queueing link update jobs for the pages in $idField...\n" );
277  foreach ( $res as $row ) {
278  $wp = WikiPage::newFromID( $row->id );
279  if ( $wp ) {
281  } else {
282  // This link entry points to a nonexistent page, so just get rid of it
283  $dbw->delete( $table,
284  [ $idField => $row->id, $nsField => $row->ns, $titleField => $row->title ],
285  __METHOD__ );
286  }
287  }
288  wfWaitForSlaves();
289  $this->output( "Link update jobs have been added to the job queue.\n" );
290  break;
291  }
292 
293  $this->output( "\n" );
294  return;
295  }
296 
303  protected static function makeValidTitle( $invalidTitle ) {
304  return strtr( trim( $invalidTitle, '_' ),
305  [ ' ' => '_', "\r" => '', "\n" => '', "\t" => '_' ] );
306  }
307 }
308 
309 $maintClass = 'CleanupInvalidDbKeys';
310 require_once RUN_MAINTENANCE_IF_MAIN;
broken
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 broken
Definition: hooks.txt:1956
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
occur
return true to allow those checks to occur
Definition: hooks.txt:1459
query
For a write query
Definition: database.txt:26
$tables
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 & $tables
Definition: hooks.txt:990
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
version
Prior to version
Definition: maintenance.txt:1
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:287
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
$res
$res
Definition: database.txt:21
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
CleanupInvalidDbKeys\writeToReport
writeToReport( $str)
Prints text to STDOUT.
Definition: cleanupInvalidDbKeys.php:113
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
key
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 key
Definition: design.txt:25
CleanupInvalidDbKeys\makeValidTitle
static makeValidTitle( $invalidTitle)
Fix possible validation issues in the given title (DB key).
Definition: cleanupInvalidDbKeys.php:303
LIST_OR
const LIST_OR
Definition: Defines.php:44
a
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
Definition: parserTests.txt:89
script
script(document.cookie)%253c/script%253e</pre ></div > !! end !! test XSS is escaped(inline) !!input< source lang
table
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 so it s not worth the trouble Since there is a job queue in the jobs table
Definition: deferred.txt:11
CleanupInvalidDbKeys\execute
execute()
Do the actual work.
Definition: cleanupInvalidDbKeys.php:82
in
null for the wiki Added in
Definition: hooks.txt:1572
not
if not
Definition: COPYING.txt:307
CleanupInvalidDbKeys\output
output( $str, $channel=null)
Prints text to STDOUT, and STDERR if STDOUT was redirected to a file.
Definition: cleanupInvalidDbKeys.php:100
Maintenance\addOption
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Definition: Maintenance.php:215
CleanupInvalidDbKeys\__construct
__construct()
Default constructor.
Definition: cleanupInvalidDbKeys.php:53
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
DB_MASTER
const DB_MASTER
Definition: defines.php:26
by
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 or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed by
Definition: APACHE-LICENSE-2.0.txt:49
run
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Program or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these that in whole or in part contains or is derived from the Program or any part to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when run
Definition: COPYING.txt:87
will
</td >< td > &</td >< td > t want your writing to be edited mercilessly and redistributed at will
Definition: All_system_messages.txt:914
or
or
Definition: COPYING.txt:140
any
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
Definition: COPYING.txt:326
wfWikiID
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition: GlobalFunctions.php:3011
on
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 on
Definition: hooks.txt:86
title
title
Definition: parserTests.txt:211
WikiPage\newFromID
static newFromID( $id, $from='fromdb')
Constructor from a page id.
Definition: WikiPage.php:158
CleanupInvalidDbKeys\$tables
static array $tables
List of tables to clean up, and the field prefix for that table.
Definition: cleanupInvalidDbKeys.php:34
CleanupInvalidDbKeys\cleanupTable
cleanupTable( $tableParams)
Identifies, and optionally cleans up, invalid titles.
Definition: cleanupInvalidDbKeys.php:122
exception
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 plus the scripts used to control compilation and installation of the executable as a special exception
Definition: COPYING.txt:157
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 my talk page
Definition: hooks.txt:2536
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
up
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set up
Definition: hooks.txt:2179
like
For a write use something like
Definition: database.txt:26
Maintenance\getOption
getOption( $name, $default=null)
Get an option, or return the default.
Definition: Maintenance.php:250
$dbr
if(! $regexes) $dbr
Definition: cleanup.php:94
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
entirely
globals will be eliminated from MediaWiki entirely
Definition: globals.txt:25
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
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
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
$maintClass
$maintClass
Definition: cleanupInvalidDbKeys.php:290
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.
Maintenance\setBatchSize
setBatchSize( $s=0)
Set the batch size.
Definition: Maintenance.php:314
CleanupInvalidDbKeys
Maintenance script that cleans up invalid titles in various tables.
Definition: cleanupInvalidDbKeys.php:32
n
print Searching for spam in $maxID pages n
Definition: cleanup.php:99
TitleValue
Represents a page (or page fragment) title within MediaWiki.
Definition: TitleValue.php:36