Set a nonzero exit status in case of maintenance script failure
authorMax Semenik <maxsem@users.mediawiki.org>
Thu, 22 Oct 2009 18:47:27 +0000 (18:47 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Thu, 22 Oct 2009 18:47:27 +0000 (18:47 +0000)
RELEASE-NOTES
maintenance/Maintenance.php
maintenance/doMaintenance.php

index ddd75fc..9005201 100644 (file)
@@ -258,6 +258,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   the parser so extensions are free to implement their own <math> tag
 * (bug 21047) Wrap 'cannotdelete' into a div with the generic 'error' class and
   an own 'mw-error-cannotdelete' class
+* Maintenance scripts now set nonzero exit codes when terminating due to error
 
 === Bug fixes in 1.16 ===
 
index bcd2913..8055af4 100644 (file)
@@ -232,7 +232,7 @@ abstract class Maintenance {
                        fwrite( $f, $err . "\n" );
                        fclose( $f );
                }
-               if( $die ) die();
+               if( $die ) exit( 1 );
        }
 
        /**
index cb6faf3..77286c3 100644 (file)
@@ -86,10 +86,13 @@ $wgTitle = null;
 
 // Do the work
 try {
-       $maintenance->execute();
+       $result = $maintenance->execute();
 } catch( MWException $mwe ) {
        echo( $mwe->getText() );
+       $result = 1;
 }
 
 // Potentially debug globals
 $maintenance->globals();
+
+exit( intval( $result ) );