+newlines on error
[lhc/web/wiklou.git] / maintenance / Maintenance.php
1 <?php
2 // Define this so scripts can easily find doMaintenance.php
3 define( 'DO_MAINTENANCE', dirname(__FILE__) . '/doMaintenance.php' );
4
5 // Make sure we're on PHP5 or better
6 if( version_compare( PHP_VERSION, '5.0.0' ) < 0 ) {
7 echo( "Sorry! This version of MediaWiki requires PHP 5; you are running " .
8 PHP_VERSION . ".\n\n" .
9 "If you are sure you already have PHP 5 installed, it may be installed\n" .
10 "in a different path from PHP 4. Check with your system administrator.\n" );
11 die();
12 }
13
14 /**
15 * Abstract maintenance class for quickly writing and churning out
16 * maintenance scripts with minimal effort. All that _must_ be defined
17 * is the execute() method. See docs/maintenance.txt for more info
18 * and a quick demo of how to use it.
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 * http://www.gnu.org/copyleft/gpl.html
34 *
35 * @author Chad Horohoe <chad@anyonecanedit.org>
36 * @since 1.16
37 * @ingroup Maintenance
38 */
39 abstract class Maintenance {
40
41 /**
42 * Constants for DB access type
43 * @see Maintenance::getDbType()
44 */
45 const DB_NONE = 0;
46 const DB_STD = 1;
47 const DB_ADMIN = 2;
48
49 // This is the desired params
50 private $mParams = array();
51
52 // Array of desired args
53 private $mArgList = array();
54
55 // This is the list of options that were actually passed
56 private $mOptions = array();
57
58 // This is the list of arguments that were actually passed
59 protected $mArgs = array();
60
61 // Name of the script currently running
62 protected $mSelf;
63
64 // Special vars for params that are always used
65 private $mQuiet = false;
66 private $mDbUser, $mDbPass;
67
68 // A description of the script, children should change this
69 protected $mDescription = '';
70
71 // Have we already loaded our user input?
72 private $mInputLoaded = false;
73
74 // Batch size. If a script supports this, they should set
75 // a default with setBatchSize()
76 protected $mBatchSize = null;
77
78 /**
79 * List of all the core maintenance scripts. This is added
80 * to scripts added by extensions in $wgMaintenanceScripts
81 * and returned by getMaintenanceScripts()
82 */
83 protected static $mCoreScripts = null;
84
85 /**
86 * Default constructor. Children should call this if implementing
87 * their own constructors
88 */
89 public function __construct() {
90 $this->addDefaultParams();
91 }
92
93 /**
94 * Do the actual work. All child classes will need to implement this
95 */
96 abstract public function execute();
97
98 /**
99 * Add a parameter to the script. Will be displayed on --help
100 * with the associated description
101 *
102 * @param $name String The name of the param (help, version, etc)
103 * @param $description String The description of the param to show on --help
104 * @param $required boolean Is the param required?
105 * @param $withArg Boolean Is an argument required with this option?
106 */
107 protected function addOption( $name, $description, $required = false, $withArg = false ) {
108 $this->mParams[ $name ] = array( 'desc' => $description, 'require' => $required, 'withArg' => $withArg );
109 }
110
111 /**
112 * Checks to see if a particular param exists.
113 * @param $name String The name of the param
114 * @return boolean
115 */
116 protected function hasOption( $name ) {
117 return isset( $this->mOptions[ $name ] );
118 }
119
120 /**
121 * Get an option, or return the default
122 * @param $name String The name of the param
123 * @param $default mixed Anything you want, default null
124 * @return mixed
125 */
126 protected function getOption( $name, $default = null ) {
127 if( $this->hasOption($name) ) {
128 return $this->mOptions[$name];
129 } else {
130 // Set it so we don't have to provide the default again
131 $this->mOptions[$name] = $default;
132 return $this->mOptions[$name];
133 }
134 }
135
136 /**
137 * Add some args that are needed. Used in formatting help
138 */
139 protected function addArgs( $args ) {
140 $this->mArgList = array_merge( $this->mArgList, $args );
141 }
142
143 /**
144 * Does a given argument exist?
145 * @param $argId int The integer value (from zero) for the arg
146 * @return boolean
147 */
148 protected function hasArg( $argId = 0 ) {
149 return isset( $this->mArgs[ $argId ] ) ;
150 }
151
152 /**
153 * Get an argument.
154 * @param $argId int The integer value (from zero) for the arg
155 * @param $default mixed The default if it doesn't exist
156 * @return mixed
157 */
158 protected function getArg( $argId = 0, $default = null ) {
159 return $this->hasArg($argId) ? $this->mArgs[$argId] : $default;
160 }
161
162 /**
163 * Set the batch size.
164 * @param $s int The number of operations to do in a batch
165 */
166 protected function setBatchSize( $s = 0 ) {
167 $this->mBatchSize = $s;
168 }
169
170 /**
171 * Get the script's name
172 * @return String
173 */
174 public function getName() {
175 return $this->mSelf;
176 }
177
178 /**
179 * Return input from stdin.
180 * @param $length int The number of bytes to read. If null,
181 * just return the handle
182 * @return mixed
183 */
184 protected function getStdin( $len = null ) {
185 $f = fopen( 'php://stdin', 'rt' );
186 if( !$len ) {
187 return $f;
188 }
189 $input = fgets( $f, $len );
190 fclose ( $f );
191 return rtrim( $input );
192 }
193
194 /**
195 * Throw some output to the user. Scripts can call this with no fears,
196 * as we handle all --quiet stuff here
197 * @param $out String The text to show to the user
198 */
199 protected function output( $out ) {
200 if( $this->mQuiet ) {
201 return;
202 }
203 $f = fopen( 'php://stdout', 'w' );
204 fwrite( $f, $out );
205 fclose( $f );
206 }
207
208 /**
209 * Throw an error to the user. Doesn't respect --quiet, so don't use
210 * this for non-error output
211 * @param $err String The error to display
212 * @param $die boolean If true, go ahead and die out.
213 */
214 protected function error( $err, $die = false ) {
215 $f = fopen( 'php://stderr', 'w' );
216 fwrite( $f, $err );
217 fclose( $f );
218 if( $die ) die();
219 }
220
221 /**
222 * Does the script need normal DB access? By default, we give Maintenance
223 * scripts admin rights to the DB (when available). Sometimes, a script needs
224 * normal access for a reason and sometimes they want no access. Subclasses
225 * should override and return one of the following values, as needed:
226 * Maintenance::DB_NONE - For no DB access at all
227 * Maintenance::DB_STD - For normal DB access
228 * Maintenance::DB_ADMIN - For admin DB access, default
229 * @return int
230 */
231 protected function getDbType() {
232 return Maintenance :: DB_ADMIN;
233 }
234
235 /**
236 * Add the default parameters to the scripts
237 */
238 private function addDefaultParams() {
239 $this->addOption( 'help', "Display this help message" );
240 $this->addOption( 'quiet', "Whether to supress non-error output" );
241 $this->addOption( 'conf', "Location of LocalSettings.php, if not default", false, true );
242 $this->addOption( 'wiki', "For specifying the wiki ID", false, true );
243 $this->addOption( 'globals', "Output globals at the end of processing for debugging" );
244 // If we support a DB, show the options
245 if( $this->getDbType() > 0 ) {
246 $this->addOption( 'dbuser', "The DB user to use for this script", false, true );
247 $this->addOption( 'dbpass', "The password to use for this script", false, true );
248 }
249 // If we support $mBatchSize, show the option
250 if( $this->mBatchSize ) {
251 $this->addOption( 'batch-size', 'Run this many operations ' .
252 'per batch, default: ' . $this->mBatchSize , false, true );
253 }
254 }
255
256 /**
257 * Spawn a child maintenance script. Pass all of the current arguments
258 * to it.
259 * @param $maintClass String A name of a child maintenance class
260 * @param $classFile String Full path of where the child is
261 * @return Maintenance child
262 */
263 protected function spawnChild( $maintClass, $classFile = null ) {
264 // If we haven't already specified, kill setup procedures
265 // for child scripts, we've already got a sane environment
266 if( !defined( 'MW_NO_SETUP' ) ) {
267 define( 'MW_NO_SETUP', true );
268 }
269
270 // Make sure the class is loaded first
271 if( !class_exists( $maintClass ) ) {
272 if( $classFile ) {
273 require_once( $classFile );
274 }
275 if( !class_exists( $maintClass ) ) {
276 $this->error( "Cannot spawn child: $maintClass\n" );
277 }
278 }
279
280 $child = new $maintClass();
281 $child->loadParamsAndArgs( $this->mSelf, $this->mOptions, $this->mArgs );
282 return $child;
283 }
284
285 /**
286 * Do some sanity checking and basic setup
287 */
288 public function setup() {
289 global $IP, $wgCommandLineMode, $wgUseNormalUser, $wgRequestTime;
290
291 # Abort if called from a web server
292 if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
293 $this->error( "This script must be run from the command line\n", true );
294 }
295
296 # Make sure we can handle script parameters
297 if( !ini_get( 'register_argc_argv' ) ) {
298 $this->error( "Cannot get command line arguments, register_argc_argv is set to false\n", true );
299 }
300
301 if( version_compare( phpversion(), '5.2.4' ) >= 0 ) {
302 // Send PHP warnings and errors to stderr instead of stdout.
303 // This aids in diagnosing problems, while keeping messages
304 // out of redirected output.
305 if( ini_get( 'display_errors' ) ) {
306 ini_set( 'display_errors', 'stderr' );
307 }
308
309 // Don't touch the setting on earlier versions of PHP,
310 // as setting it would disable output if you'd wanted it.
311
312 // Note that exceptions are also sent to stderr when
313 // command-line mode is on, regardless of PHP version.
314 }
315
316 # Set the memory limit
317 ini_set( 'memory_limit', -1 );
318
319 $wgRequestTime = microtime(true);
320
321 # Define us as being in Mediawiki
322 define( 'MEDIAWIKI', true );
323
324 # Setup $IP, using MW_INSTALL_PATH if it exists
325 $IP = strval( getenv('MW_INSTALL_PATH') ) !== ''
326 ? getenv('MW_INSTALL_PATH')
327 : realpath( dirname( __FILE__ ) . '/..' );
328
329 $wgCommandLineMode = true;
330 # Turn off output buffering if it's on
331 @ob_end_flush();
332
333 if (!isset( $wgUseNormalUser ) ) {
334 $wgUseNormalUser = false;
335 }
336
337 $this->loadParamsAndArgs();
338 $this->maybeHelp();
339 $this->validateParamsAndArgs();
340 }
341
342 /**
343 * Clear all params and arguments.
344 */
345 public function clearParamsAndArgs() {
346 $this->mOptions = array();
347 $this->mArgs = array();
348 $this->mInputLoaded = false;
349 }
350
351 /**
352 * Process command line arguments
353 * $mOptions becomes an array with keys set to the option names
354 * $mArgs becomes a zero-based array containing the non-option arguments
355 *
356 * @param $self String The name of the script, if any
357 * @param $opts Array An array of options, in form of key=>value
358 * @param $args Array An array of command line arguments
359 */
360 public function loadParamsAndArgs( $self = null, $opts = null, $args = null ) {
361 # If we were given opts or args, set those and return early
362 if( $self ) {
363 $this->mSelf = $self;
364 $this->mInputLoaded = true;
365 }
366 if( $opts ) {
367 $this->mOptions = $opts;
368 $this->mInputLoaded = true;
369 }
370 if( $args ) {
371 $this->mArgs = $args;
372 $this->mInputLoaded = true;
373 }
374
375 # If we've already loaded input (either by user values or from $argv)
376 # skip on loading it again. The array_shift() will corrupt values if
377 # it's run again and again
378 if( $this->mInputLoaded ) {
379 $this->loadSpecialVars();
380 return;
381 }
382
383 global $argv;
384 $this->mSelf = array_shift( $argv );
385
386 $options = array();
387 $args = array();
388
389 # Parse arguments
390 for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
391 if ( $arg == '--' ) {
392 # End of options, remainder should be considered arguments
393 $arg = next( $argv );
394 while( $arg !== false ) {
395 $args[] = $arg;
396 $arg = next( $argv );
397 }
398 break;
399 } elseif ( substr( $arg, 0, 2 ) == '--' ) {
400 # Long options
401 $option = substr( $arg, 2 );
402 if ( isset( $this->mParams[$option] ) && $this->mParams[$option]['withArg'] ) {
403 $param = next( $argv );
404 if ( $param === false ) {
405 $this->error( "$arg needs a value after it\n", true );
406 }
407 $options[$option] = $param;
408 } else {
409 $bits = explode( '=', $option, 2 );
410 if( count( $bits ) > 1 ) {
411 $option = $bits[0];
412 $param = $bits[1];
413 } else {
414 $param = 1;
415 }
416 $options[$option] = $param;
417 }
418 } elseif ( substr( $arg, 0, 1 ) == '-' ) {
419 # Short options
420 for ( $p=1; $p<strlen( $arg ); $p++ ) {
421 $option = $arg{$p};
422 if ( $this->mParams[$option]['withArg'] ) {
423 $param = next( $argv );
424 if ( $param === false ) {
425 $this->error( "$arg needs a value after it\n", true );
426 }
427 $options[$option] = $param;
428 } else {
429 $options[$option] = 1;
430 }
431 }
432 } else {
433 $args[] = $arg;
434 }
435 }
436
437 $this->mOptions = $options;
438 $this->mArgs = $args;
439 $this->loadSpecialVars();
440 $this->mInputLoaded = true;
441 }
442
443 /**
444 * Run some validation checks on the params, etc
445 */
446 private function validateParamsAndArgs() {
447 # Check to make sure we've got all the required ones
448 foreach( $this->mParams as $opt => $info ) {
449 if( $info['require'] && !$this->hasOption($opt) ) {
450 $this->error( "Param $opt required.\n", true );
451 }
452 }
453
454 # Also make sure we've got enough arguments
455 if ( count( $this->mArgs ) < count( $this->mArgList ) ) {
456 $this->error( "Not enough arguments passed\n", true );
457 }
458 }
459
460 /**
461 * Handle the special variables that are global to all scripts
462 */
463 private function loadSpecialVars() {
464 if( $this->hasOption( 'dbuser' ) )
465 $this->mDbUser = $this->getOption( 'dbuser' );
466 if( $this->hasOption( 'dbpass' ) )
467 $this->mDbPass = $this->getOption( 'dbpass' );
468 if( $this->hasOption( 'quiet' ) )
469 $this->mQuiet = true;
470 if( $this->hasOption( 'batch-size' ) )
471 $this->mBatchSize = $this->getOption( 'batch-size' );
472 }
473
474 /**
475 * Maybe show the help.
476 * @param $force boolean Whether to force the help to show, default false
477 */
478 private function maybeHelp( $force = false ) {
479 if( $this->hasOption('help') || in_array( 'help', $this->mArgs ) || $force ) {
480 $this->mQuiet = false;
481 if( $this->mDescription ) {
482 $this->output( "\n" . $this->mDescription . "\n" );
483 }
484 $this->output( "\nUsage: php " . $this->mSelf );
485 if( $this->mParams ) {
486 $this->output( " [--" . implode( array_keys( $this->mParams ), "|--" ) . "]" );
487 }
488 if( $this->mArgList ) {
489 $this->output( " <" . implode( $this->mArgList, "> <" ) . ">" );
490 }
491 $this->output( "\n" );
492 foreach( $this->mParams as $par => $info ) {
493 $this->output( "\t$par : " . $info['desc'] . "\n" );
494 }
495 die( 1 );
496 }
497 }
498
499 /**
500 * Handle some last-minute setup here.
501 */
502 private function finalSetup() {
503 global $wgCommandLineMode, $wgUseNormalUser, $wgShowSQLErrors;
504 global $wgTitle, $wgProfiling, $IP, $wgDBadminuser, $wgDBadminpassword;
505 global $wgDBuser, $wgDBpassword, $wgDBservers, $wgLBFactoryConf;
506
507 # Turn off output buffering again, it might have been turned on in the settings files
508 if( ob_get_level() ) {
509 ob_end_flush();
510 }
511 # Same with these
512 $wgCommandLineMode = true;
513
514 # If these were passed, use them
515 if( $this->mDbUser )
516 $wgDBadminuser = $this->mDbUser;
517 if( $this->mDbPass )
518 $wgDBadminpass = $this->mDbPass;
519
520 if ( empty( $wgUseNormalUser ) && isset( $wgDBadminuser ) ) {
521 $wgDBuser = $wgDBadminuser;
522 $wgDBpassword = $wgDBadminpassword;
523
524 if( $wgDBservers ) {
525 foreach ( $wgDBservers as $i => $server ) {
526 $wgDBservers[$i]['user'] = $wgDBuser;
527 $wgDBservers[$i]['password'] = $wgDBpassword;
528 }
529 }
530 if( isset( $wgLBFactoryConf['serverTemplate'] ) ) {
531 $wgLBFactoryConf['serverTemplate']['user'] = $wgDBuser;
532 $wgLBFactoryConf['serverTemplate']['password'] = $wgDBpassword;
533 }
534 }
535
536 if ( defined( 'MW_CMDLINE_CALLBACK' ) ) {
537 $fn = MW_CMDLINE_CALLBACK;
538 $fn();
539 }
540
541 $wgShowSQLErrors = true;
542 @set_time_limit( 0 );
543
544 $wgProfiling = false; // only for Profiler.php mode; avoids OOM errors
545 }
546
547 /**
548 * Potentially debug globals. Originally a feature only
549 * for refreshLinks
550 */
551 public function globals() {
552 if( $this->hasOption( 'globals' ) ) {
553 print_r( $GLOBALS );
554 }
555 }
556
557 /**
558 * Do setup specific to WMF
559 */
560 public function loadWikimediaSettings() {
561 global $IP, $wgNoDBParam, $wgUseNormalUser, $wgConf;
562
563 if ( empty( $wgNoDBParam ) ) {
564 # Check if we were passed a db name
565 if ( isset( $this->mOptions['wiki'] ) ) {
566 $db = $this->mOptions['wiki'];
567 } else {
568 $db = array_shift( $this->mArgs );
569 }
570 list( $site, $lang ) = $wgConf->siteFromDB( $db );
571
572 # If not, work out the language and site the old way
573 if ( is_null( $site ) || is_null( $lang ) ) {
574 if ( !$db ) {
575 $lang = 'aa';
576 } else {
577 $lang = $db;
578 }
579 if ( isset( $this->mArgs[0] ) ) {
580 $site = array_shift( $this->mArgs );
581 } else {
582 $site = 'wikipedia';
583 }
584 }
585 } else {
586 $lang = 'aa';
587 $site = 'wikipedia';
588 }
589
590 # This is for the IRC scripts, which now run as the apache user
591 # The apache user doesn't have access to the wikiadmin_pass command
592 if ( $_ENV['USER'] == 'apache' ) {
593 #if ( posix_geteuid() == 48 ) {
594 $wgUseNormalUser = true;
595 }
596
597 putenv( 'wikilang=' . $lang );
598
599 $DP = $IP;
600 ini_set( 'include_path', ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" );
601
602 if ( $lang == 'test' && $site == 'wikipedia' ) {
603 define( 'TESTWIKI', 1 );
604 }
605 }
606
607 /**
608 * Generic setup for most installs. Returns the location of LocalSettings
609 * @return String
610 */
611 public function loadSettings() {
612 global $wgWikiFarm, $wgCommandLineMode, $IP, $DP;
613
614 $wgWikiFarm = false;
615 if ( isset( $this->mOptions['conf'] ) ) {
616 $settingsFile = $this->mOptions['conf'];
617 } else {
618 $settingsFile = "$IP/LocalSettings.php";
619 }
620 if ( isset( $this->mOptions['wiki'] ) ) {
621 $bits = explode( '-', $this->mOptions['wiki'] );
622 if ( count( $bits ) == 1 ) {
623 $bits[] = '';
624 }
625 define( 'MW_DB', $bits[0] );
626 define( 'MW_PREFIX', $bits[1] );
627 }
628
629 if ( ! is_readable( $settingsFile ) ) {
630 $this->error( "A copy of your installation's LocalSettings.php\n" .
631 "must exist and be readable in the source directory.\n", true );
632 }
633 $wgCommandLineMode = true;
634 $DP = $IP;
635 $this->finalSetup();
636 return $settingsFile;
637 }
638
639 /**
640 * Support function for cleaning up redundant text records
641 * @param $delete boolean Whether or not to actually delete the records
642 * @author Rob Church <robchur@gmail.com>
643 */
644 protected function purgeRedundantText( $delete = true ) {
645 # Data should come off the master, wrapped in a transaction
646 $dbw = wfGetDB( DB_MASTER );
647 $dbw->begin();
648
649 $tbl_arc = $dbw->tableName( 'archive' );
650 $tbl_rev = $dbw->tableName( 'revision' );
651 $tbl_txt = $dbw->tableName( 'text' );
652
653 # Get "active" text records from the revisions table
654 $this->output( "Searching for active text records in revisions table..." );
655 $res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" );
656 while( $row = $dbw->fetchObject( $res ) ) {
657 $cur[] = $row->rev_text_id;
658 }
659 $this->output( "done.\n" );
660
661 # Get "active" text records from the archive table
662 $this->output( "Searching for active text records in archive table..." );
663 $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" );
664 while( $row = $dbw->fetchObject( $res ) ) {
665 $cur[] = $row->ar_text_id;
666 }
667 $this->output( "done.\n" );
668
669 # Get the IDs of all text records not in these sets
670 $this->output( "Searching for inactive text records..." );
671 $set = implode( ', ', $cur );
672 $res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" );
673 $old = array();
674 while( $row = $dbw->fetchObject( $res ) ) {
675 $old[] = $row->old_id;
676 }
677 $this->output( "done.\n" );
678
679 # Inform the user of what we're going to do
680 $count = count( $old );
681 $this->output( "$count inactive items found.\n" );
682
683 # Delete as appropriate
684 if( $delete && $count ) {
685 $this->output( "Deleting..." );
686 $set = implode( ', ', $old );
687 $dbw->query( "DELETE FROM $tbl_txt WHERE old_id IN ( $set )" );
688 $this->output( "done.\n" );
689 }
690
691 # Done
692 $dbw->commit();
693 }
694
695 /**
696 * Get the maintenance directory.
697 */
698 protected function getDir() {
699 return dirname( __FILE__ );
700 }
701
702 /**
703 * Get the list of available maintenance scripts. Note
704 * that if you call this _before_ calling doMaintenance
705 * you won't have any extensions in it yet
706 * @return array
707 */
708 public static function getMaintenanceScripts() {
709 global $wgMaintenanceScripts;
710 return $wgMaintenanceScripts + self::getCoreScripts();
711 }
712
713 /**
714 * Return all of the core maintenance scripts
715 * @todo Don't make this list, maybe just scan all the files in /maintenance?
716 * @return array
717 */
718 private static function getCoreScripts() {
719 if( !self::$mCoreScripts ) {
720 $d = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
721 self::$mCoreScripts = array(
722 # Main script list
723 'AddWiki' => $d . 'addwiki.php',
724 'AttachLatest' => $d . 'attachLatest.php',
725 'BenchmarkPurge' => $d . 'benchmarkPurge.php',
726 'ChangePassword' => $d . 'changePassword.php',
727 'CheckAutoLoader' => $d . 'checkAutoLoader.php',
728 'CheckBadRedirects' => $d . 'checkBadRedirects.php',
729 'CheckImages' => $d . 'checkImages.php',
730 'CheckSyntax' => $d . 'checkSyntax.php',
731 'CheckUsernames' => $d . 'checkUsernames.php',
732 'CleanupSpam' => $d . 'cleanupSpam.php',
733 'ClearInterwikiCache' => $d . 'clear_interwiki_cache.php',
734 'clear_stats' => $d . 'clear_stats.php',
735 'ConvertLinks' => $d . 'convertLinks.php',
736 'ConvertUserOptions' => $d . 'convertUserOptions.php',
737 'CreateAndPromote' => $d . 'createAndPromote.php',
738 'DeleteArchivedFiles' => $d . 'deleteArchivedFiles.php',
739 'DeleteArchivedRevisions' => $d . 'deleteArchivedRevisions.php',
740 'DeleteBatch' => $d . 'deleteBatch.php',
741 'DeleteDefaultMessages' => $d . 'deleteDefaultMessages.php',
742 'DeleteImageCache' => $d . 'deleteImageMemcached.php',
743 'DeleteOldRevisions' => $d . 'deleteOldRevisions.php',
744 'DeleteOrphanedRevisions' => $d . 'deleteOrphanedRevisions.php',
745 'DeleteRevision' => $d . 'deleteRevision.php',
746 'DumpLinks' => $d . 'dumpLinks.php',
747 'DumpSisterSites' => $d . 'dumpSisterSites.php',
748 'UploadDumper' => $d . 'dumpUploads.php',
749 'EditCLI' => $d . 'edit.php',
750 'EvalPrompt' => $d . 'eval.php',
751 'FetchText' => $d . 'fetchText.php',
752 'FindHooks' => $d . 'findhooks.php',
753 'FixSlaveDesync' => $d . 'fixSlaveDesync.php',
754 'FixTimestamps' => $d . 'fixTimestamps.php',
755 'FixUserRegistration' => $d . 'fixUserRegistration.php',
756 'GenerateSitemap' => $d . 'generateSitemap.php',
757 'GetLagTimes' => $d . 'getLagTimes.php',
758 'GetSlaveServer' => $d . 'getSlaveServer.php',
759 'InitEditCount' => $d . 'initEditCount.php',
760 'InitStats' => $d . 'initStats.php',
761 'mcTest' => $d . 'mctest.php',
762 'MoveBatch' => $d . 'moveBatch.php',
763 'nextJobDb' => $d . 'nextJobDB.php',
764 'NukeNS' => $d . 'nukeNS.php',
765 'NukePage' => $d . 'nukePage.php',
766 'Orphans' => $d . 'orphans.php',
767 'PopulateCategory' => $d . 'populateCategory.php',
768 'PopulateLogSearch' => $d . 'populateLogSearch.php',
769 'PopulateParentId' => $d . 'populateParentId.php',
770 'Protect' => $d . 'protect.php',
771 'PurgeList' => $d . 'purgeList.php',
772 'PurgeOldText' => $d . 'purgeOldText.php',
773 'ReassignEdits' => $d . 'reassignEdits.php',
774 'RebuildAll' => $d . 'rebuildall.php',
775 'RebuildFileCache' => $d . 'rebuildFileCache.php',
776 'RebuildLocalisationCache' => $d . 'rebuildLocalisationCache.php',
777 'RebuildMessages' => $d . 'rebuildmessages.php',
778 'RebuildRecentchanges' => $d . 'rebuildrecentchanges.php',
779 'RebuildTextIndex' => $d . 'rebuildtextindex.php',
780 'RefreshImageCount' => $d . 'refreshImageCount.php',
781 'RefreshLinks' => $d . 'refreshLinks.php',
782 'RemoveUnusedAccounts' => $d . 'removeUnusedAccounts.php',
783 'RenameDbPrefix' => $d . 'renameDbPrefix.php',
784 'RenameWiki' => $d . 'renamewiki.php',
785 'DumpRenderer' => $d . 'renderDump.php',
786 'RunJobs' => $d . 'runJobs.php',
787 'ShowJobs' => $d . 'showJobs.php',
788 'ShowStats' => $d . 'showStats.php',
789 'MwSql' => $d . 'sql.php',
790 'CacheStats' => $d . 'stats.php',
791 'Undelete' => $d . 'undelete.php',
792 'UpdateArticleCount' => $d . 'updateArticleCount.php',
793 'UpdateRestrictions' => $d . 'updateRestrictions.php',
794 'UpdateSearchIndex' => $d . 'updateSearchIndex.php',
795 'UpdateSpecialPages' => $d . 'updateSpecialPages.php',
796 'WaitForSlave' => $d . 'waitForSlave.php',
797
798 # Language scripts
799 'AllTrans' => $d . 'language/alltrans.php',
800 );
801 }
802 return self::$mCoreScripts;
803 }
804 }