(bug 17948) Maintenance scripts now exit(0) or exit(1) as appropriate
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 6 Apr 2009 14:41:33 +0000 (14:41 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 6 Apr 2009 14:41:33 +0000 (14:41 +0000)
15 files changed:
RELEASE-NOTES
maintenance/archives/upgradeWatchlist.php
maintenance/deleteOrphanedRevisions.php
maintenance/fuzz-tester.php
maintenance/importImages.php
maintenance/initStats.php
maintenance/language/checkLanguage.inc
maintenance/language/rebuildLanguage.php
maintenance/language/transstat.php
maintenance/rebuildall.php
maintenance/rebuildrecentchanges.php
maintenance/rebuildtextindex.php
maintenance/removeUnusedAccounts.php
maintenance/storage/compressOld.php
maintenance/update.php

index 1fabf9b..80d3a47 100644 (file)
@@ -327,6 +327,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * The "noautoblock" flag is no longer displayed in the block log when blocking
   an IP address
 * (bug 18009) $wgHooks and $wgExtensionFunctions now support closures
+* (bug 17948) Maintenance scripts now exit(0) or exit(1) as appropriate
 
 == API changes in 1.15 ==
 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
index 9788aa5..ee01673 100644 (file)
@@ -10,7 +10,7 @@ print "This script is obsolete!";
 print "It is retained in the source here in case some of its
 code might be useful for ad-hoc conversion tasks, but it is
 not maintained and probably won't even work as is.";
-exit();
+exit(1);
 
 # Convert watchlists to new format
 
index 78441f8..f440cd7 100644 (file)
@@ -15,8 +15,10 @@ require_once( 'commandLine.inc' );
 require_once( 'deleteOrphanedRevisions.inc.php' );
 echo( "Delete Orphaned Revisions\n" );
 
-if( isset( $options['help'] ) )
+if( isset( $options['help'] ) ) {
        showUsage();
+       exit(1);
+}
 
 $report = isset( $options['report'] );
 
@@ -39,7 +41,7 @@ echo( "found {$count}.\n" );
 # Nothing to do?
 if( $report || $count == 0 ) {
        $dbw->immediateCommit();
-       exit();
+       exit(0);
 }
 
 # Delete each revision
index 1ca496a..f401215 100644 (file)
@@ -2447,7 +2447,7 @@ function validateHTML($text) {
     if (curl_error($ch)) {
         trigger_error("Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) );
         print "Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) . " - exiting.\n";
-        exit();
+        exit(1);
     }
 
     curl_close ($ch);
index 7997b0d..727af3c 100644 (file)
@@ -184,7 +184,7 @@ if( count( $args ) > 0 ) {
        showUsage();
 }
 
-exit();
+exit(0);
 
 function showUsage( $reason = false ) {
        if( $reason ) {
@@ -211,5 +211,5 @@ Options:
 --unprotect             Unprotects all uploaded images
 
 END;
-       exit();
+       exit(1);
 }
\ No newline at end of file
index d206c20..bb0cf30 100644 (file)
@@ -16,7 +16,7 @@ echo( "Refresh Site Statistics\n\n" );
 
 if( isset( $options['help'] ) ) {
        showHelp();
-       exit();
+       exit(1);
 }
 
 require "$IP/maintenance/initStats.inc";
index 52281b5..486490e 100644 (file)
@@ -24,7 +24,7 @@ class CheckLanguageCLI {
        public function __construct( Array $options ) {
                if ( isset( $options['help'] ) ) {
                        echo $this->help();
-                       exit();
+                       exit(1);
                }
 
                if ( isset( $options['lang'] ) ) {
@@ -459,7 +459,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI {
        public function __construct( Array $options, $extension ) {
                if ( isset( $options['help'] ) ) {
                        echo $this->help();
-                       exit();
+                       exit(1);
                }
 
                if ( isset( $options['lang'] ) ) {
index 91fda3f..bfbda85 100644 (file)
@@ -39,7 +39,7 @@ Options:
        * remove-unknown: Remove unknown messages.
 
 END;
-       exit();
+       exit(1);
 }
 
 # Get the language code
index b433abb..fe50c6c 100644 (file)
@@ -40,7 +40,7 @@ Usage: php transstat.php [--help] [--output=csv|text|wiki]
 Example: php maintenance/transstat.php --output=text
 
 END;
-       exit();
+       exit(1);
 }
 
 
index ca7e4c0..536ebd3 100644 (file)
@@ -37,6 +37,6 @@ print "\n\n** Rebuilding links tables -- this can take a long time. It should be
 refreshLinks( 1 );
 
 print "Done.\n";
-exit();
+exit(0);
 
 
index 9311d0f..4231ff7 100644 (file)
@@ -19,6 +19,6 @@ $wgDBpassword         = $wgDBadminpassword;
 rebuildRecentChangesTable();
 
 print "Done.\n";
-exit();
+exit(0);
 
 
index 73dca87..b19f78b 100644 (file)
@@ -18,7 +18,7 @@ require_once( "rebuildtextindex.inc" );
 $database = wfGetDB( DB_MASTER );
 if( !$database instanceof DatabaseMysql ) {
        print "This script is only for MySQL.\n";
-       exit();
+       exit(1);
 }
 
 $wgTitle = Title::newFromText( "Rebuild text index script" );
@@ -28,6 +28,6 @@ rebuildTextIndex( $database );
 createTextIndex( $database );
 
 print "Done.\n";
-exit();
+exit(0);
 
 
index 419955b..5f74b65 100644 (file)
@@ -16,7 +16,7 @@ $fname = 'removeUnusedAccounts';
 
 if( isset( $options['help'] ) ) {
        showHelp();
-       exit();
+       exit(1);
 }
 
 # Do an initial scan for inactive accounts and report the result
index 6f8b48e..7ff102a 100644 (file)
@@ -68,6 +68,6 @@ if ( $success ) {
        print "Done.\n";
 }
 
-exit();
+exit(0);
 
 
index 3f48413..f3fb6b3 100644 (file)
@@ -29,7 +29,7 @@ if( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) {
        echo( "No superuser credentials could be found. Please provide the details\n" );
        echo( "of a user with appropriate permissions to update the database. See\n" );
        echo( "AdminSettings.sample for more details.\n\n" );
-       exit();
+       exit(1);
 }
 
 # Attempt to connect to the database as a privileged user
@@ -40,7 +40,7 @@ if( !$wgDatabase->isOpen() ) {
        # Appears to have failed
        echo( "A connection to the database could not be established. Check the\n" );
        echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
-       exit();
+       exit(1);
 }
 
 print "Going to run database updates for ".wfWikiID()."\n";