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