- /**
- * Get the list of available maintenance scripts. Note
- * that if you call this _before_ calling doMaintenance
- * you won't have any extensions in it yet
- * @return Array
- */
- public static function getMaintenanceScripts() {
- global $wgMaintenanceScripts;
- return $wgMaintenanceScripts + self::getCoreScripts();
- }
-
- /**
- * Return all of the core maintenance scripts
- * @return array
- */
- protected static function getCoreScripts() {
- if ( !self::$mCoreScripts ) {
- $paths = array(
- __DIR__,
- __DIR__ . '/language',
- __DIR__ . '/storage',
- );
- self::$mCoreScripts = array();
- foreach ( $paths as $p ) {
- $handle = opendir( $p );
- while ( ( $file = readdir( $handle ) ) !== false ) {
- if ( $file == 'Maintenance.php' ) {
- continue;
- }
- $file = $p . '/' . $file;
- if ( is_dir( $file ) || !strpos( $file, '.php' ) ||
- ( strpos( file_get_contents( $file ), '$maintClass' ) === false ) ) {
- continue;
- }
- require $file;
- $vars = get_defined_vars();
- if ( array_key_exists( 'maintClass', $vars ) ) {
- self::$mCoreScripts[$vars['maintClass']] = $file;
- }
- }
- closedir( $handle );
- }
- }
- return self::$mCoreScripts;
- }
-