Merge "mediawiki.widgets: Remove use of bind() for lexical 'this' binding"
[lhc/web/wiklou.git] / maintenance / dumpBackup.php
index 6b5792a..d4255a0 100644 (file)
@@ -31,7 +31,7 @@ class DumpBackup extends BackupDumper {
        function __construct( $args = null ) {
                parent::__construct();
 
-               $this->mDescription = <<<TEXT
+               $this->addDescription( <<<TEXT
 This script dumps the wiki page or logging database into an
 XML interchange wrapper format for export or backup.
 
@@ -40,7 +40,8 @@ XML output is sent to stdout; progress reports are sent to stderr.
 WARNING: this is not a full database dump! It is merely for public export
          of your wiki. For full backup, see our online help at:
          https://www.mediawiki.org/wiki/Backup
-TEXT;
+TEXT
+               );
                $this->stderr = fopen( "php://stderr", "wt" );
                // Actions
                $this->addOption( 'full', 'Dump all revisions of every page' );
@@ -95,16 +96,15 @@ TEXT;
                $this->reporting = !$this->hasOption( 'quiet' );
 
                if ( $this->hasOption( 'pagelist' ) ) {
-                       $olddir = getcwd();
-                       chdir( $originalDir );
-                       $pages = file( $this->getOption( 'quiet' ) );
-                       chdir( $olddir );
+                       $filename = $this->getOption( 'pagelist' );
+                       $pages = file( $filename );
                        if ( $pages === false ) {
-                               echo "Unable to open file {$options['pagelist']}\n";
-                               die( 1 );
+                               $this->fatalError( "Unable to open file {$filename}\n" );
                        }
                        $pages = array_map( 'trim', $pages );
-                       $this->pages = array_filter( $pages, create_function( '$x', 'return $x !== "";' ) );
+                       $this->pages = array_filter( $pages, function ( $x ) {
+                               return $x !== '';
+                       } );
                }
 
                if ( $this->hasOption( 'start' ) ) {