Show HTTP error (if any) when scary transclusion fails
[lhc/web/wiklou.git] / maintenance / preprocessDump.php
index a6c3839..5c2b0d4 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 /**
  * Take page text out of an XML dump file and preprocess it to obj.
- * It may be useful for getting preprocessor statistics or filling the 
+ * It may be useful for getting preprocessor statistics or filling the
  * preprocessor cache.
  *
- * Copyright (C) 2011 Platonides - http://www.mediawiki.org/
+ * Copyright © 2011 Platonides - http://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * @file
  * @ingroup Maintenance
  */
+
 require_once( dirname( __FILE__ ) . '/dumpIterator.php' );
 
+/**
+ * Maintenance script that takes page text out of an XML dump file and
+ * preprocesses it to obj.
+ *
+ * @ingroup Maintenance
+ */
 class PreprocessDump extends DumpIterator {
 
        /* Variables for dressing up as a parser */
@@ -37,7 +43,7 @@ class PreprocessDump extends DumpIterator {
                global $wgParser;
                return $wgParser->getStripList();
        }
-               
+
        public function __construct() {
                parent::__construct();
                $this->addOption( 'cache', 'Use and populate the preprocessor cache.', false, false );
@@ -48,29 +54,13 @@ class PreprocessDump extends DumpIterator {
                return Maintenance::DB_NONE;
        }
 
-       public function finalSetup() {
-               parent::finalSetup();
-
-               global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks;
-               $wgUseDatabaseMessages = false;
-               $wgLocalisationCacheConf['storeClass'] =  'LCStore_Null';
-               $wgHooks['InterwikiLoadPrefix'][] = 'PreprocessDump::disableInterwikis';
-       }
-
-       static function disableInterwikis( $prefix, &$data ) {
-               # Title::newFromText will check on each namespaced article if it's an interwiki.
-               # We always answer that it is not.
-
-               return false;
-       }
-
        public function checkOptions() {
                global $wgParser, $wgParserConf, $wgPreprocessorCacheThreshold;
 
                if ( !$this->hasOption( 'cache' ) ) {
                        $wgPreprocessorCacheThreshold = false;
                }
-               
+
                if ( $this->hasOption( 'preprocessor' ) ) {
                        $name = $this->getOption( 'preprocessor' );
                } elseif ( isset( $wgParserConf['preprocessorClass'] ) ) {
@@ -82,7 +72,7 @@ class PreprocessDump extends DumpIterator {
                $wgParser->firstCallInit();
                $this->mPreprocessor = new $name( $this );
        }
-       
+
        /**
         * Callback function for each revision, preprocessToObj()
         * @param $rev Revision
@@ -98,5 +88,5 @@ class PreprocessDump extends DumpIterator {
 }
 
 $maintClass = "PreprocessDump";
-require( RUN_MAINTENANCE_IF_MAIN );
+require_once( RUN_MAINTENANCE_IF_MAIN );