Remove 'minordefault' preference completely
[lhc/web/wiklou.git] / maintenance / checkAutoLoader.php
1 <?php
2 /**
3 * Check the autoloader
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @ingroup Maintenance
21 */
22
23 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
24
25 class CheckAutoLoader extends Maintenance {
26 public function __construct() {
27 parent::__construct();
28 $this->mDescription = "AutoLoader sanity checks";
29 }
30 public function execute() {
31 global $wgAutoloadLocalClasses, $IP;
32 $files = array_unique( $wgAutoloadLocalClasses );
33
34 foreach ( $files as $file ) {
35 if ( function_exists( 'parsekit_compile_file' ) ) {
36 $parseInfo = parsekit_compile_file( "$IP/$file" );
37 $classes = array_keys( $parseInfo['class_table'] );
38 } else {
39 $contents = file_get_contents( "$IP/$file" );
40 $m = array();
41 preg_match_all( '/\n\s*class\s+([a-zA-Z0-9_]+)/', $contents, $m, PREG_PATTERN_ORDER );
42 $classes = $m[1];
43 }
44 foreach ( $classes as $class ) {
45 if ( !isset( $wgAutoloadLocalClasses[$class] ) ) {
46 // printf( "%-50s Unlisted, in %s\n", $class, $file );
47 $this->output( "\t'$class' => '$file',\n" );
48 } elseif ( $wgAutoloadLocalClasses[$class] !== $file ) {
49 $this->output( "$class: Wrong file: found in $file, listed in " . $wgAutoloadLocalClasses[$class] . "\n" );
50 }
51 }
52 }
53 }
54 }
55
56 $maintClass = "CheckAutoLoader";
57 require_once( DO_MAINTENANCE );