Remove last wfDie()s from maintenance
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 6 Jul 2011 19:57:52 +0000 (19:57 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 6 Jul 2011 19:57:52 +0000 (19:57 +0000)
maintenance/backup.inc
maintenance/dumpBackup.php

index 206d443..583b109 100644 (file)
@@ -120,7 +120,7 @@ class BackupDumper {
                                                $sinks[] = $sink;
                                        }
                                        if ( !isset( $this->outputTypes[$val] ) ) {
-                                               wfDie( "Unrecognized output sink type '$val'\n" );
+                                               $this->fatalError( "Unrecognized output sink type '$val'" );
                                        }
                                        $type = $this->outputTypes[$val];
                                        $sink = new $type( $param );
@@ -130,7 +130,7 @@ class BackupDumper {
                                                $sink = new DumpOutput();
                                        }
                                        if ( !isset( $this->filterTypes[$val] ) ) {
-                                               wfDie( "Unrecognized filter type '$val'\n" );
+                                               $this->fatalError( "Unrecognized filter type '$val'" );
                                        }
                                        $type = $this->filterTypes[$val];
                                        $filter = new $type( $sink, $param );
@@ -150,8 +150,8 @@ class BackupDumper {
                                        if ( !function_exists( 'utf8_normalize' ) ) {
                                                wfDl( "php_utfnormal.so" );
                                                if ( !function_exists( 'utf8_normalize' ) ) {
-                                                       wfDie( "Failed to load UTF-8 normalization extension. " .
-                                                               "Install or remove --force-normal parameter to use slower code.\n" );
+                                                       $this->fatalError( "Failed to load UTF-8 normalization extension. " .
+                                                               "Install or remove --force-normal parameter to use slower code." );
                                                }
                                        }
                                        break;
@@ -302,6 +302,11 @@ class BackupDumper {
        function progress( $string ) {
                fwrite( $this->stderr, $string . "\n" );
        }
+
+       function fatalError( $msg ) {
+               $this->progress( "$msg\n" );
+               die(1);
+       }
 }
 
 class ExportProgressFilter extends DumpFilter {
index 1640029..e058198 100644 (file)
@@ -44,7 +44,8 @@ if ( isset( $options['pagelist'] ) ) {
        $pages = file( $options['pagelist'] );
        chdir( $olddir );
        if ( $pages === false ) {
-               wfDie( "Unable to open file {$options['pagelist']}\n" );
+               echo( "Unable to open file {$options['pagelist']}\n" );
+               die(1);
        }
        $pages = array_map( 'trim', $pages );
        $dumper->pages = array_filter( $pages, create_function( '$x', 'return $x !== "";' ) );