Also check if 'debug_backtrace' is disabled in Maintenance::shouldExecute()
authorAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Wed, 25 Jun 2014 20:39:58 +0000 (22:39 +0200)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 26 Jun 2014 00:06:32 +0000 (00:06 +0000)
And execute the script if $wgCommandLineMode is true. Otherwise scripts
never get executed.

Change-Id: I609d859b616905ab44a060a861be500609e5a9f0

maintenance/Maintenance.php

index e316d9e..ffb07eb 100644 (file)
@@ -136,6 +136,13 @@ abstract class Maintenance {
         * @return bool
         */
        public static function shouldExecute() {
+               global $wgCommandLineMode;
+
+               if ( !function_exists( 'debug_backtrace' ) ) {
+                       // If someone has a better idea...
+                       return $wgCommandLineMode;
+               }
+
                $bt = debug_backtrace();
                $count = count( $bt );
                if ( $count < 2 ) {