BryanDavis has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392363 )

Change subject: Maintenance: add die() method
......................................................................

Maintenance: add die() method

Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::die() method. This is intended to make it easier to review
flow control in maintenance scripts.

Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
---
M maintenance/Maintenance.php
M maintenance/backup.inc
M maintenance/benchmarks/benchmarkJSMinPlus.php
M maintenance/benchmarks/benchmarkParse.php
M maintenance/benchmarks/benchmarkPurge.php
M maintenance/benchmarks/benchmarkTidy.php
M maintenance/changePassword.php
M maintenance/checkComposerLockUpToDate.php
M maintenance/cleanupSpam.php
M maintenance/cleanupTitles.php
M maintenance/cleanupUploadStash.php
M maintenance/compareParsers.php
M maintenance/convertExtensionToRegistration.php
M maintenance/copyFileBackend.php
M maintenance/copyJobQueue.php
M maintenance/createAndPromote.php
M maintenance/createCommonPasswordCdb.php
M maintenance/deleteBatch.php
M maintenance/deleteDefaultMessages.php
M maintenance/deleteEqualMessages.php
M maintenance/dumpBackup.php
M maintenance/dumpIterator.php
M maintenance/edit.php
M maintenance/eraseArchivedFile.php
M maintenance/exportSites.php
M maintenance/findHooks.php
M maintenance/findOrphanedFiles.php
M maintenance/fixDoubleRedirects.php
M maintenance/fixTimestamps.php
M maintenance/formatInstallDoc.php
M maintenance/generateJsonI18n.php
M maintenance/generateSitemap.php
M maintenance/getConfiguration.php
M maintenance/getText.php
M maintenance/hhvm/makeRepo.php
M maintenance/importDump.php
M maintenance/importImages.php
M maintenance/importTextFiles.php
M maintenance/install.php
M maintenance/invalidateUserSessions.php
M maintenance/language/generateCollationData.php
M maintenance/language/generateNormalizerDataAr.php
M maintenance/language/langmemusage.php
M maintenance/makeTestEdits.php
M maintenance/manageJobs.php
M maintenance/mctest.php
M maintenance/mergeMessageFileList.php
M maintenance/migrateFileRepoLayout.php
M maintenance/migrateUserGroup.php
M maintenance/minify.php
M maintenance/moveBatch.php
M maintenance/mwdocgen.php
M maintenance/pageExists.php
M maintenance/populateContentModel.php
M maintenance/populateImageSha1.php
M maintenance/populateRevisionLength.php
M maintenance/populateRevisionSha1.php
M maintenance/protect.php
M maintenance/pruneFileCache.php
M maintenance/purgeParserCache.php
M maintenance/reassignEdits.php
M maintenance/rebuildFileCache.php
M maintenance/rebuildLocalisationCache.php
M maintenance/rebuildSitesCache.php
M maintenance/rebuildrecentchanges.php
M maintenance/rebuildtextindex.php
M maintenance/recountCategories.php
M maintenance/refreshImageMetadata.php
M maintenance/refreshLinks.php
M maintenance/removeUnusedAccounts.php
M maintenance/renameDbPrefix.php
M maintenance/resetUserEmail.php
M maintenance/rollbackEdits.php
M maintenance/runJobs.php
M maintenance/shell.php
M maintenance/sql.php
M maintenance/sqlite.php
M maintenance/storage/checkStorage.php
M maintenance/storage/compressOld.php
M maintenance/storage/dumpRev.php
M maintenance/storage/orphanStats.php
M maintenance/syncFileBackend.php
M maintenance/undelete.php
M maintenance/update.php
M maintenance/updateDoubleWidthSearch.php
M maintenance/updateExtensionJsonSchema.php
M maintenance/updateRestrictions.php
M maintenance/updateSpecialPages.php
M maintenance/userOptions.php
M maintenance/validateRegistrationFile.php
M maintenance/view.php
M maintenance/wrapOldPasswords.php
92 files changed, 259 insertions(+), 259 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/392363/1

diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index d37b990..2f629e8 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -398,19 +398,31 @@
         * Throw an error to the user. Doesn't respect --quiet, so don't use
         * this for non-error output
         * @param string $err The error to display
-        * @param int $die If > 0, go ahead and die out using this int as the 
code
+        * @param int $die Deprecated since 1.31, use Maintenance::die() instead
         */
        protected function error( $err, $die = 0 ) {
+               if ( intval( $die ) !== 0 ) {
+                       wfDeprecated( __METHOD__ . '( $err, $die )' , '1.31' );
+                       $this->die( $err, intval( $die ) );
+               }
                $this->outputChanneled( false );
                if ( PHP_SAPI == 'cli' ) {
                        fwrite( STDERR, $err . "\n" );
                } else {
                        print $err;
                }
-               $die = intval( $die );
-               if ( $die > 0 ) {
-                       die( $die );
-               }
+       }
+
+       /**
+        * Output a message and terminate the current script.
+        *
+        * @param string $msg Error message
+        * @param int $exitCode PHP exit status. Should be in range 1-254.
+        * @since 1.31
+        */
+       protected function die( $msg, $exitCode = 1 ) {
+               $this->error( $msg );
+               exit( $exitCode );
        }
 
        private $atLineStart = true;
@@ -559,7 +571,7 @@
                        $joined = implode( ', ', $missing );
                        $msg = "The following extensions are required to be 
installed "
                                . "for this script to run: $joined. Please 
enable them and then try again.";
-                       $this->error( $msg, 1 );
+                       $this->die( $msg );
                }
        }
 
@@ -652,17 +664,17 @@
 
                # Abort if called from a web server
                if ( isset( $_SERVER ) && isset( $_SERVER['REQUEST_METHOD'] ) ) 
{
-                       $this->error( 'This script must be run from the command 
line', true );
+                       $this->die( 'This script must be run from the command 
line' );
                }
 
                if ( $IP === null ) {
-                       $this->error( "\$IP not set, aborting!\n" .
-                               '(Did you forget to call parent::__construct() 
in your maintenance script?)', 1 );
+                       $this->die( "\$IP not set, aborting!\n" .
+                               '(Did you forget to call parent::__construct() 
in your maintenance script?)' );
                }
 
                # Make sure we can handle script parameters
                if ( !defined( 'HPHP_VERSION' ) && !ini_get( 
'register_argc_argv' ) ) {
-                       $this->error( 'Cannot get command line arguments, 
register_argc_argv is set to false', true );
+                       $this->die( 'Cannot get command line arguments, 
register_argc_argv is set to false' );
                }
 
                // Send PHP warnings and errors to stderr instead of stdout.
@@ -1177,9 +1189,9 @@
                }
 
                if ( !is_readable( $settingsFile ) ) {
-                       $this->error( "A copy of your installation's 
LocalSettings.php\n" .
+                       $this->die( "A copy of your installation's 
LocalSettings.php\n" .
                                "must exist and be readable in the source 
directory.\n" .
-                               "Use --conf to specify it.", true );
+                               "Use --conf to specify it." );
                }
                $wgCommandLineMode = true;
 
diff --git a/maintenance/backup.inc b/maintenance/backup.inc
index 60b8a7a..2086cd8 100644
--- a/maintenance/backup.inc
+++ b/maintenance/backup.inc
@@ -421,7 +421,7 @@
        }
 
        function fatalError( $msg ) {
-               $this->error( "$msg\n", 1 );
+               $this->die( "$msg\n" );
        }
 }
 
diff --git a/maintenance/benchmarks/benchmarkJSMinPlus.php 
b/maintenance/benchmarks/benchmarkJSMinPlus.php
index dc92516..fc00248 100644
--- a/maintenance/benchmarks/benchmarkJSMinPlus.php
+++ b/maintenance/benchmarks/benchmarkJSMinPlus.php
@@ -41,7 +41,7 @@
                $content = file_get_contents( $this->getOption( 'file' ) );
                MediaWiki\restoreWarnings();
                if ( $content === false ) {
-                       $this->error( 'Unable to open input file', 1 );
+                       $this->die( 'Unable to open input file' );
                }
 
                $filename = basename( $this->getOption( 'file' ) );
diff --git a/maintenance/benchmarks/benchmarkParse.php 
b/maintenance/benchmarks/benchmarkParse.php
index 1753250..da87b5a 100644
--- a/maintenance/benchmarks/benchmarkParse.php
+++ b/maintenance/benchmarks/benchmarkParse.php
@@ -106,7 +106,7 @@
 
                $loops = $this->getOption( 'loops', 1 );
                if ( $loops < 1 ) {
-                       $this->error( 'Invalid number of loops specified', true 
);
+                       $this->die( 'Invalid number of loops specified' );
                }
                $startUsage = getrusage();
                $startTime = microtime( true );
diff --git a/maintenance/benchmarks/benchmarkPurge.php 
b/maintenance/benchmarks/benchmarkPurge.php
index e006cf5..8b23c05 100644
--- a/maintenance/benchmarks/benchmarkPurge.php
+++ b/maintenance/benchmarks/benchmarkPurge.php
@@ -37,7 +37,7 @@
        public function execute() {
                global $wgUseSquid, $wgSquidServers;
                if ( !$wgUseSquid ) {
-                       $this->error( "Squid purge benchmark doesn't do much 
without squid support on.", true );
+                       $this->die( "Squid purge benchmark doesn't do much 
without squid support on." );
                } else {
                        $this->output( "There are " . count( $wgSquidServers ) 
. " defined squid servers:\n" );
                        if ( $this->hasOption( 'count' ) ) {
diff --git a/maintenance/benchmarks/benchmarkTidy.php 
b/maintenance/benchmarks/benchmarkTidy.php
index 1479174..da3f93c 100644
--- a/maintenance/benchmarks/benchmarkTidy.php
+++ b/maintenance/benchmarks/benchmarkTidy.php
@@ -15,19 +15,19 @@
        public function execute() {
                $html = file_get_contents( $this->getOption( 'file' ) );
                if ( $html === false ) {
-                       $this->error( "Unable to open input file", 1 );
+                       $this->die( "Unable to open input file" );
                }
                if ( $this->hasOption( 'driver' ) || $this->hasOption( 
'tidy-config' ) ) {
                        $config = json_decode( $this->getOption( 'tidy-config', 
'{}' ), true );
                        if ( !is_array( $config ) ) {
-                               $this->error( "Invalid JSON tidy config", 1 );
+                               $this->die( "Invalid JSON tidy config" );
                        }
                        $config += [ 'driver' => $this->getOption( 'driver', 
'RemexHtml' ) ];
                        $driver = MWTidy::factory( $config );
                } else {
                        $driver = MWTidy::singleton();
                        if ( !$driver ) {
-                               $this->error( "Tidy disabled or not installed", 
1 );
+                               $this->die( "Tidy disabled or not installed" );
                        }
                }
 
diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php
index 9fa6632..e53fe7a 100644
--- a/maintenance/changePassword.php
+++ b/maintenance/changePassword.php
@@ -46,10 +46,10 @@
                } elseif ( $this->hasOption( "userid" ) ) {
                        $user = User::newFromId( $this->getOption( 'userid' ) );
                } else {
-                       $this->error( "A \"user\" or \"userid\" must be set to 
change the password for", true );
+                       $this->die( "A \"user\" or \"userid\" must be set to 
change the password for" );
                }
                if ( !$user || !$user->getId() ) {
-                       $this->error( "No such user: " . $this->getOption( 
'user' ), true );
+                       $this->die( "No such user: " . $this->getOption( 'user' 
) );
                }
                $password = $this->getOption( 'password' );
                try {
@@ -64,7 +64,7 @@
                        $user->saveSettings();
                        $this->output( "Password set for " . $user->getName() . 
"\n" );
                } catch ( PasswordError $pwe ) {
-                       $this->error( $pwe->getText(), true );
+                       $this->die( $pwe->getText() );
                }
        }
 }
diff --git a/maintenance/checkComposerLockUpToDate.php 
b/maintenance/checkComposerLockUpToDate.php
index e5b4c13..586c58d 100644
--- a/maintenance/checkComposerLockUpToDate.php
+++ b/maintenance/checkComposerLockUpToDate.php
@@ -24,9 +24,8 @@
                        // Maybe they're using mediawiki/vendor?
                        $lockLocation = "$IP/vendor/composer.lock";
                        if ( !file_exists( $lockLocation ) ) {
-                               $this->error(
-                                       'Could not find composer.lock file. 
Have you run "composer install --no-dev"?',
-                                       1
+                               $this->die(
+                                       'Could not find composer.lock file. 
Have you run "composer install --no-dev"?'
                                );
                        }
                }
@@ -51,10 +50,9 @@
                        }
                }
                if ( $found ) {
-                       $this->error(
+                       $this->die(
                                'Error: your composer.lock file is not up to 
date. ' .
-                                       'Run "composer update --no-dev" to 
install newer dependencies',
-                               1
+                                       'Run "composer update --no-dev" to 
install newer dependencies'
                        );
                } else {
                        // We couldn't find any out-of-date dependencies, so 
assume everything is ok!
diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php
index fc3cc5b..df117c4 100644
--- a/maintenance/cleanupSpam.php
+++ b/maintenance/cleanupSpam.php
@@ -47,7 +47,7 @@
                $username = wfMessage( 'spambot_username' )->text();
                $wgUser = User::newSystemUser( $username );
                if ( !$wgUser ) {
-                       $this->error( "Invalid username specified in 
'spambot_username' message: $username", true );
+                       $this->die( "Invalid username specified in 
'spambot_username' message: $username" );
                }
                // Hack: Grant bot rights so we don't flood RecentChanges
                $wgUser->addGroup( 'bot' );
@@ -55,7 +55,7 @@
                $spec = $this->getArg();
                $like = LinkFilter::makeLikeArray( $spec );
                if ( !$like ) {
-                       $this->error( "Not a valid hostname specification: 
$spec", true );
+                       $this->die( "Not a valid hostname specification: $spec" 
);
                }
 
                if ( $this->hasOption( 'all' ) ) {
diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php
index 50e17d8..77780b7 100644
--- a/maintenance/cleanupTitles.php
+++ b/maintenance/cleanupTitles.php
@@ -165,7 +165,7 @@
                        $title = $verified;
                }
                if ( is_null( $title ) ) {
-                       $this->error( "Something awry; empty title.", true );
+                       $this->die( "Something awry; empty title." );
                }
                $ns = $title->getNamespace();
                $dest = $title->getDBkey();
diff --git a/maintenance/cleanupUploadStash.php 
b/maintenance/cleanupUploadStash.php
index 14c6a6b..1f84d93 100644
--- a/maintenance/cleanupUploadStash.php
+++ b/maintenance/cleanupUploadStash.php
@@ -122,7 +122,7 @@
                $iterator = $tempRepo->getBackend()->getFileList( [ 'dir' => 
$dir, 'adviseStat' => 1 ] );
                $this->output( "Deleting orphaned temp files...\n" );
                if ( strpos( $dir, '/local-temp' ) === false ) { // sanity check
-                       $this->error( "Temp repo is not using the temp 
container.", 1 ); // die
+                       $this->die( "Temp repo is not using the temp 
container." );
                }
                $i = 0;
                $batch = []; // operation batch
diff --git a/maintenance/compareParsers.php b/maintenance/compareParsers.php
index f2540c7..a930429 100644
--- a/maintenance/compareParsers.php
+++ b/maintenance/compareParsers.php
@@ -97,7 +97,7 @@
                if ( $this->hasOption( 'tidy' ) ) {
                        global $wgUseTidy;
                        if ( !$wgUseTidy ) {
-                               $this->error( 'Tidy was requested but 
$wgUseTidy is not set in LocalSettings.php', true );
+                               $this->die( 'Tidy was requested but $wgUseTidy 
is not set in LocalSettings.php' );
                        }
                        $this->options->setTidy( true );
                }
diff --git a/maintenance/convertExtensionToRegistration.php 
b/maintenance/convertExtensionToRegistration.php
index 0554949..38d9b95 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -82,7 +82,7 @@
                unset( $var );
                $arg = $this->getArg( 0 );
                if ( !is_file( $arg ) ) {
-                       $this->error( "$arg is not a file.", true );
+                       $this->die( "$arg is not a file." );
                }
                require $arg;
                unset( $arg );
@@ -160,14 +160,14 @@
        protected function handleExtensionFunctions( $realName, $value ) {
                foreach ( $value as $func ) {
                        if ( $func instanceof Closure ) {
-                               $this->error( "Error: Closures cannot be 
converted to JSON. " .
-                                       "Please move your extension function 
somewhere else.", 1
+                               $this->die( "Error: Closures cannot be 
converted to JSON. " .
+                                       "Please move your extension function 
somewhere else."
                                );
                        }
                        // check if $func exists in the global scope
                        if ( function_exists( $func ) ) {
-                               $this->error( "Error: Global functions cannot 
be converted to JSON. " .
-                                       "Please move your extension function 
($func) into a class.", 1
+                               $this->die( "Error: Global functions cannot be 
converted to JSON. " .
+                                       "Please move your extension function 
($func) into a class."
                                );
                        }
                }
@@ -239,14 +239,14 @@
                        }
                        foreach ( $handlers as $func ) {
                                if ( $func instanceof Closure ) {
-                                       $this->error( "Error: Closures cannot 
be converted to JSON. " .
-                                               "Please move the handler for 
$hookName somewhere else.", 1
+                                       $this->die( "Error: Closures cannot be 
converted to JSON. " .
+                                               "Please move the handler for 
$hookName somewhere else."
                                        );
                                }
                                // Check if $func exists in the global scope
                                if ( function_exists( $func ) ) {
-                                       $this->error( "Error: Global functions 
cannot be converted to JSON. " .
-                                               "Please move the handler for 
$hookName inside a class.", 1
+                                       $this->die( "Error: Global functions 
cannot be converted to JSON. " .
+                                               "Please move the handler for 
$hookName inside a class."
                                        );
                                }
                        }
diff --git a/maintenance/copyFileBackend.php b/maintenance/copyFileBackend.php
index ee103b8..5ac8f91 100644
--- a/maintenance/copyFileBackend.php
+++ b/maintenance/copyFileBackend.php
@@ -81,7 +81,7 @@
                                        'adviseStat' => true // avoid HEADs
                                ] );
                                if ( $srcPathsRel === null ) {
-                                       $this->error( "Could not list files in 
$container.", 1 ); // die
+                                       $this->die( "Could not list files in 
$container." );
                                }
                        }
 
@@ -93,7 +93,7 @@
                                        'adviseStat' => true // avoid HEADs
                                ] );
                                if ( $dstPathsRel === null ) {
-                                       $this->error( "Could not list files in 
$container.", 1 ); // die
+                                       $this->die( "Could not list files in 
$container." );
                                }
                                $this->statCache = [];
                                foreach ( $dstPathsRel as $dstPathRel ) {
@@ -174,12 +174,12 @@
                $srcPathsRel = $src->getFileList( [
                        'dir' => $src->getRootStoragePath() . "/$backendRel" ] 
);
                if ( $srcPathsRel === null ) {
-                       $this->error( "Could not list files in source 
container.", 1 ); // die
+                       $this->die( "Could not list files in source container." 
);
                }
                $dstPathsRel = $dst->getFileList( [
                        'dir' => $dst->getRootStoragePath() . "/$backendRel" ] 
);
                if ( $dstPathsRel === null ) {
-                       $this->error( "Could not list files in destination 
container.", 1 ); // die
+                       $this->die( "Could not list files in destination 
container." );
                }
                // Get the list of destination files
                $relFilesDstSha1 = [];
@@ -263,7 +263,7 @@
                        $status = $dst->prepare( [ 'dir' => dirname( $dstPath 
), 'bypassReadOnly' => 1 ] );
                        if ( !$status->isOK() ) {
                                $this->error( print_r( 
$status->getErrorsArray(), true ) );
-                               $this->error( "$wikiId: Could not copy $srcPath 
to $dstPath.", 1 ); // die
+                               $this->die( "$wikiId: Could not copy $srcPath 
to $dstPath." );
                        }
                        $ops[] = [ 'op' => 'store',
                                'src' => $fsFile->getPath(), 'dst' => $dstPath, 
'overwrite' => 1 ];
@@ -280,7 +280,7 @@
                $elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
                if ( !$status->isOK() ) {
                        $this->error( print_r( $status->getErrorsArray(), true 
) );
-                       $this->error( "$wikiId: Could not copy file batch.", 1 
); // die
+                       $this->die( "$wikiId: Could not copy file batch." );
                } elseif ( count( $copiedRel ) ) {
                        $this->output( "\n\tCopied these file(s) 
[{$elapsed_ms}ms]:\n\t" .
                                implode( "\n\t", $copiedRel ) . "\n\n" );
@@ -317,7 +317,7 @@
                $elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
                if ( !$status->isOK() ) {
                        $this->error( print_r( $status->getErrorsArray(), true 
) );
-                       $this->error( "$wikiId: Could not delete file batch.", 
1 ); // die
+                       $this->die( "$wikiId: Could not delete file batch." );
                } elseif ( count( $deletedRel ) ) {
                        $this->output( "\n\tDeleted these file(s) 
[{$elapsed_ms}ms]:\n\t" .
                                implode( "\n\t", $deletedRel ) . "\n\n" );
diff --git a/maintenance/copyJobQueue.php b/maintenance/copyJobQueue.php
index 08e40fd..c3735ee 100644
--- a/maintenance/copyJobQueue.php
+++ b/maintenance/copyJobQueue.php
@@ -48,9 +48,9 @@
                $dstKey = $this->getOption( 'dst' );
 
                if ( !isset( $wgJobQueueMigrationConfig[$srcKey] ) ) {
-                       $this->error( "\$wgJobQueueMigrationConfig not set for 
'$srcKey'.", 1 );
+                       $this->die( "\$wgJobQueueMigrationConfig not set for 
'$srcKey'." );
                } elseif ( !isset( $wgJobQueueMigrationConfig[$dstKey] ) ) {
-                       $this->error( "\$wgJobQueueMigrationConfig not set for 
'$dstKey'.", 1 );
+                       $this->die( "\$wgJobQueueMigrationConfig not set for 
'$dstKey'." );
                }
 
                $types = ( $this->getOption( 'type' ) === 'all' )
diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php
index 1872716..ef973f8 100644
--- a/maintenance/createAndPromote.php
+++ b/maintenance/createAndPromote.php
@@ -63,15 +63,15 @@
 
                $user = User::newFromName( $username );
                if ( !is_object( $user ) ) {
-                       $this->error( "invalid username.", true );
+                       $this->die( "invalid username." );
                }
 
                $exists = ( 0 !== $user->idForName() );
 
                if ( $exists && !$force ) {
-                       $this->error( "Account exists. Perhaps you want the 
--force option?", true );
+                       $this->die( "Account exists. Perhaps you want the 
--force option?" );
                } elseif ( !$exists && !$password ) {
-                       $this->error( "Argument <password> required!", false );
+                       $this->error( "Argument <password> required!" );
                        $this->maybeHelp( true );
                } elseif ( $exists ) {
                        $inGroups = $user->getGroups();
@@ -133,7 +133,7 @@
                                        $user->saveSettings();
                                }
                        } catch ( PasswordError $pwe ) {
-                               $this->error( $pwe->getText(), true );
+                               $this->die( $pwe->getText() );
                        }
                }
 
diff --git a/maintenance/createCommonPasswordCdb.php 
b/maintenance/createCommonPasswordCdb.php
index f7e0c0f..a289b15 100644
--- a/maintenance/createCommonPasswordCdb.php
+++ b/maintenance/createCommonPasswordCdb.php
@@ -60,12 +60,12 @@
                $outfile = $this->getArg( 1 );
 
                if ( !is_readable( $infile ) && $infile !== 'php://stdin' ) {
-                       $this->error( "Cannot open input file $infile for 
reading", 1 );
+                       $this->die( "Cannot open input file $infile for 
reading" );
                }
 
                $file = fopen( $infile, 'r' );
                if ( $file === false ) {
-                       $this->error( "Cannot read input file $infile", 1 );
+                       $this->die( "Cannot read input file $infile" );
                }
 
                try {
@@ -109,7 +109,7 @@
                                " (out of $i) passwords to $outfile\n"
                        );
                } catch ( \Cdb\Exception $e ) {
-                       $this->error( "Error writing cdb file: " . 
$e->getMessage(), 2 );
+                       $this->die( "Error writing cdb file: " . 
$e->getMessage(), 2 );
                }
        }
 }
diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php
index 0020446..7ca2a02 100644
--- a/maintenance/deleteBatch.php
+++ b/maintenance/deleteBatch.php
@@ -65,7 +65,7 @@
                        $user = User::newFromName( $username );
                }
                if ( !$user ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
                $wgUser = $user;
 
@@ -77,7 +77,7 @@
 
                # Setup
                if ( !$file ) {
-                       $this->error( "Unable to read file, exiting", true );
+                       $this->die( "Unable to read file, exiting" );
                }
 
                $dbw = $this->getDB( DB_MASTER );
diff --git a/maintenance/deleteDefaultMessages.php 
b/maintenance/deleteDefaultMessages.php
index ba8662a..a623fae 100644
--- a/maintenance/deleteDefaultMessages.php
+++ b/maintenance/deleteDefaultMessages.php
@@ -72,7 +72,7 @@
                // in order to hide it in RecentChanges.
                $user = User::newFromName( 'MediaWiki default' );
                if ( !$user ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
                $user->addGroup( 'bot' );
                $wgUser = $user;
diff --git a/maintenance/deleteEqualMessages.php 
b/maintenance/deleteEqualMessages.php
index 5fc7d18..d8efa8b 100644
--- a/maintenance/deleteEqualMessages.php
+++ b/maintenance/deleteEqualMessages.php
@@ -123,7 +123,7 @@
                                $this->fetchMessageInfo( false, $messageInfo );
                        } else {
                                if ( !isset( $langCodes[$langCode] ) ) {
-                                       $this->error( 'Invalid language code: ' 
. $langCode, 1 );
+                                       $this->die( 'Invalid language code: ' . 
$langCode );
                                }
                                $this->fetchMessageInfo( $langCode, 
$messageInfo );
                        }
@@ -164,7 +164,7 @@
 
                $user = User::newSystemUser( 'MediaWiki default', [ 'steal' => 
true ] );
                if ( !$user ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
                global $wgUser;
                $wgUser = $user;
diff --git a/maintenance/dumpBackup.php b/maintenance/dumpBackup.php
index 9bf1222..db141e4 100644
--- a/maintenance/dumpBackup.php
+++ b/maintenance/dumpBackup.php
@@ -87,7 +87,7 @@
                } elseif ( $this->hasOption( 'revrange' ) ) {
                        $this->dump( WikiExporter::RANGE, $textMode );
                } else {
-                       $this->error( 'No valid action specified.', 1 );
+                       $this->die( 'No valid action specified.' );
                }
        }
 
diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php
index 6dbad94..8e290b8 100644
--- a/maintenance/dumpIterator.php
+++ b/maintenance/dumpIterator.php
@@ -48,7 +48,7 @@
 
        public function execute() {
                if ( !( $this->hasOption( 'file' ) ^ $this->hasOption( 'dump' ) 
) ) {
-                       $this->error( "You must provide a file or dump", true );
+                       $this->die( "You must provide a file or dump" );
                }
 
                $this->checkOptions();
@@ -70,8 +70,8 @@
                if ( $this->getOption( 'dump' ) == '-' ) {
                        $source = new ImportStreamSource( $this->getStdin() );
                } else {
-                       $this->error( "Sorry, I don't support dump filenames 
yet. "
-                               . "Use - and provide it on stdin on the 
meantime.", true );
+                       $this->die( "Sorry, I don't support dump filenames yet. 
"
+                               . "Use - and provide it on stdin on the 
meantime." );
                }
                $importer = new WikiImporter( $source, $this->getConfig() );
 
diff --git a/maintenance/edit.php b/maintenance/edit.php
index 4219ed0..92fe6ee 100644
--- a/maintenance/edit.php
+++ b/maintenance/edit.php
@@ -59,7 +59,7 @@
                        $wgUser = User::newFromName( $userName );
                }
                if ( !$wgUser ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
                if ( $wgUser->isAnon() ) {
                        $wgUser->addToDatabase();
@@ -67,13 +67,13 @@
 
                $title = Title::newFromText( $this->getArg() );
                if ( !$title ) {
-                       $this->error( "Invalid title", true );
+                       $this->die( "Invalid title" );
                }
 
                if ( $this->hasOption( 'nocreate' ) && !$title->exists() ) {
-                       $this->error( "Page does not exist", true );
+                       $this->die( "Page does not exist" );
                } elseif ( $this->hasOption( 'createonly' ) && $title->exists() 
) {
-                       $this->error( "Page already exists", true );
+                       $this->die( "Page already exists" );
                }
 
                $page = WikiPage::factory( $title );
diff --git a/maintenance/eraseArchivedFile.php 
b/maintenance/eraseArchivedFile.php
index d94d49b..f1a0388 100644
--- a/maintenance/eraseArchivedFile.php
+++ b/maintenance/eraseArchivedFile.php
@@ -50,7 +50,7 @@
 
                if ( $filekey === '*' ) { // all versions by name
                        if ( !strlen( $filename ) ) {
-                               $this->error( "Missing --filename parameter.", 
1 );
+                               $this->die( "Missing --filename parameter." );
                        }
                        $afile = false;
                } else { // specified version
@@ -60,7 +60,7 @@
                                [ 'fa_storage_group' => 'deleted', 
'fa_storage_key' => $filekey ],
                                __METHOD__, [], $fileQuery['joins'] );
                        if ( !$row ) {
-                               $this->error( "No deleted file exists with key 
'$filekey'.", 1 );
+                               $this->die( "No deleted file exists with key 
'$filekey'." );
                        }
                        $filename = $row->fa_name;
                        $afile = ArchivedFile::newFromRow( $row );
@@ -68,7 +68,7 @@
 
                $file = wfLocalFile( $filename );
                if ( $file->exists() ) {
-                       $this->error( "File '$filename' is still a public file, 
use the delete form.\n", 1 );
+                       $this->die( "File '$filename' is still a public file, 
use the delete form.\n" );
                }
 
                $this->output( "Purging all thumbnails for file '$filename'..." 
);
diff --git a/maintenance/exportSites.php b/maintenance/exportSites.php
index b1e4fa9..8e84b8f 100644
--- a/maintenance/exportSites.php
+++ b/maintenance/exportSites.php
@@ -37,7 +37,7 @@
                $handle = fopen( $file, 'w' );
 
                if ( !$handle ) {
-                       $this->error( "Failed to open $file for writing.\n", 1 
);
+                       $this->die( "Failed to open $file for writing.\n" );
                }
 
                $exporter = new SiteExporter( $handle );
diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php
index fd36db1..3ccd72f 100644
--- a/maintenance/findHooks.php
+++ b/maintenance/findHooks.php
@@ -143,7 +143,7 @@
                ) {
                        $this->output( "Looks good!\n" );
                } else {
-                       $this->error( 'The script finished with errors.', 1 );
+                       $this->die( 'The script finished with errors.' );
                }
        }
 
diff --git a/maintenance/findOrphanedFiles.php 
b/maintenance/findOrphanedFiles.php
index c4cab71..962f820 100644
--- a/maintenance/findOrphanedFiles.php
+++ b/maintenance/findOrphanedFiles.php
@@ -37,7 +37,7 @@
 
                $repo = RepoGroup::singleton()->getLocalRepo();
                if ( $repo->hasSha1Storage() ) {
-                       $this->error( "Local repo uses SHA-1 file storage 
names; aborting.", 1 );
+                       $this->die( "Local repo uses SHA-1 file storage names; 
aborting." );
                }
 
                $directory = $repo->getZonePath( 'public' );
@@ -51,7 +51,7 @@
 
                $list = $repo->getBackend()->getFileList( [ 'dir' => $directory 
] );
                if ( $list === null ) {
-                       $this->error( "Could not get file listing.", 1 );
+                       $this->die( "Could not get file listing." );
                }
 
                $pathBatch = [];
diff --git a/maintenance/fixDoubleRedirects.php 
b/maintenance/fixDoubleRedirects.php
index 8c9faca..83e01fd 100644
--- a/maintenance/fixDoubleRedirects.php
+++ b/maintenance/fixDoubleRedirects.php
@@ -48,7 +48,7 @@
                if ( $this->hasOption( 'title' ) ) {
                        $title = Title::newFromText( $this->getOption( 'title' 
) );
                        if ( !$title || !$title->isRedirect() ) {
-                               $this->error( $title->getPrefixedText() . " is 
not a redirect!\n", true );
+                               $this->die( $title->getPrefixedText() . " is 
not a redirect!\n" );
                        }
                } else {
                        $title = null;
diff --git a/maintenance/fixTimestamps.php b/maintenance/fixTimestamps.php
index 796ec26..462af7c 100644
--- a/maintenance/fixTimestamps.php
+++ b/maintenance/fixTimestamps.php
@@ -56,7 +56,7 @@
                $row = $dbw->fetchObject( $res );
 
                if ( is_null( $row->minrev ) ) {
-                       $this->error( "No revisions in search period.", true );
+                       $this->die( "No revisions in search period." );
                }
 
                $minRev = $row->minrev;
@@ -99,14 +99,14 @@
 
                $numBadRevs = count( $badRevs );
                if ( $numBadRevs > $numGoodRevs ) {
-                       $this->error(
+                       $this->die(
                                "The majority of revisions in the search 
interval are marked as bad.
 
                Are you sure the offset ($offset) has the right sign? Positive 
means the clock
                was incorrectly set forward, negative means the clock was 
incorrectly set back.
 
                If the offset is right, then increase the search interval until 
there are enough
-               good revisions to provide a majority reference.", true );
+               good revisions to provide a majority reference." );
                } elseif ( $numBadRevs == 0 ) {
                        $this->output( "No bad revisions found.\n" );
                        exit( 0 );
diff --git a/maintenance/formatInstallDoc.php b/maintenance/formatInstallDoc.php
index e2b3c41..f4ea02c 100644
--- a/maintenance/formatInstallDoc.php
+++ b/maintenance/formatInstallDoc.php
@@ -41,8 +41,7 @@
                        $fileName = $this->getArg( 0 );
                        $inFile = fopen( $fileName, 'r' );
                        if ( !$inFile ) {
-                               $this->error( "Unable to open input file 
\"$fileName\"" );
-                               exit( 1 );
+                               $this->die( "Unable to open input file 
\"$fileName\"" );
                        }
                } else {
                        $inFile = STDIN;
@@ -52,8 +51,7 @@
                        $fileName = $this->getOption( 'outfile' );
                        $outFile = fopen( $fileName, 'w' );
                        if ( !$outFile ) {
-                               $this->error( "Unable to open output file 
\"$fileName\"" );
-                               exit( 1 );
+                               $this->die( "Unable to open output file 
\"$fileName\"" );
                        }
                } else {
                        $outFile = STDOUT;
diff --git a/maintenance/generateJsonI18n.php b/maintenance/generateJsonI18n.php
index a84f2ae52..3642c47 100644
--- a/maintenance/generateJsonI18n.php
+++ b/maintenance/generateJsonI18n.php
@@ -55,7 +55,7 @@
 
                if ( $extension ) {
                        if ( $phpfile ) {
-                               $this->error( "The phpfile is already 
specified, conflicts with --extension.", 1 );
+                               $this->die( "The phpfile is already specified, 
conflicts with --extension." );
                        }
                        $phpfile = 
"$IP/extensions/$extension/$extension.i18n.php";
                }
@@ -101,28 +101,28 @@
                        $this->output( "Creating directory $jsondir.\n" );
                        $success = mkdir( $jsondir );
                        if ( !$success ) {
-                               $this->error( "Could not create directory 
$jsondir", 1 );
+                               $this->die( "Could not create directory 
$jsondir" );
                        }
                }
 
                if ( !is_readable( $phpfile ) ) {
-                       $this->error( "Error reading $phpfile", 1 );
+                       $this->die( "Error reading $phpfile" );
                }
                $messages = null;
                include $phpfile;
                $phpfileContents = file_get_contents( $phpfile );
 
                if ( !isset( $messages ) ) {
-                       $this->error( "PHP file $phpfile does not define 
\$messages array", 1 );
+                       $this->die( "PHP file $phpfile does not define 
\$messages array" );
                }
 
                if ( !$messages ) {
-                       $this->error( "PHP file $phpfile contains an empty 
\$messages array. " .
-                               "Maybe it was already converted?", 1 );
+                       $this->die( "PHP file $phpfile contains an empty 
\$messages array. " .
+                               "Maybe it was already converted?" );
                }
 
                if ( !isset( $messages['en'] ) || !is_array( $messages['en'] ) 
) {
-                       $this->error( "PHP file $phpfile does not set language 
codes", 1 );
+                       $this->die( "PHP file $phpfile does not set language 
codes" );
                }
 
                foreach ( $messages as $langcode => $langmsgs ) {
@@ -142,7 +142,7 @@
                                FormatJson::encode( $langmsgs, "\t", 
FormatJson::ALL_OK ) . "\n"
                        );
                        if ( $success === false ) {
-                               $this->error( "FAILED to write $jsonfile", 1 );
+                               $this->die( "FAILED to write $jsonfile" );
                        }
                        $this->output( "$jsonfile\n" );
                }
diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php
index 26a9c39..e46dbf6 100644
--- a/maintenance/generateSitemap.php
+++ b/maintenance/generateSitemap.php
@@ -182,7 +182,7 @@
                # Create directory if needed
                $fspath = $this->getOption( 'fspath', getcwd() );
                if ( !wfMkdirParents( $fspath, null, __METHOD__ ) ) {
-                       $this->error( "Can not create directory $fspath.", 1 );
+                       $this->die( "Can not create directory $fspath." );
                }
 
                $this->fspath = realpath( $fspath ) . DIRECTORY_SEPARATOR;
diff --git a/maintenance/getConfiguration.php b/maintenance/getConfiguration.php
index 65ffe14..18dcc22 100644
--- a/maintenance/getConfiguration.php
+++ b/maintenance/getConfiguration.php
@@ -64,7 +64,7 @@
 
                $validFormat = in_array( $format, self::$outFormats );
                if ( !$validFormat ) {
-                       $this->error( "--format set to an unrecognized format", 
0 );
+                       $this->error( "--format set to an unrecognized format" 
);
                        $error_out = true;
                }
 
diff --git a/maintenance/getText.php b/maintenance/getText.php
index f519a79..8a8140e 100644
--- a/maintenance/getText.php
+++ b/maintenance/getText.php
@@ -42,13 +42,13 @@
                $titleText = $this->getArg( 0 );
                $title = Title::newFromText( $titleText );
                if ( !$title ) {
-                       $this->error( "$titleText is not a valid title.\n", 
true );
+                       $this->die( "$titleText is not a valid title.\n" );
                }
 
                $rev = Revision::newFromTitle( $title );
                if ( !$rev ) {
                        $titleText = $title->getPrefixedText();
-                       $this->error( "Page $titleText does not exist.\n", true 
);
+                       $this->die( "Page $titleText does not exist.\n" );
                }
                $content = $rev->getContent( $this->hasOption( 'show-private' )
                        ? Revision::RAW
@@ -56,7 +56,7 @@
 
                if ( $content === false ) {
                        $titleText = $title->getPrefixedText();
-                       $this->error( "Couldn't extract the text from 
$titleText.\n", true );
+                       $this->die( "Couldn't extract the text from 
$titleText.\n" );
                }
                $this->output( $content->serialize() );
        }
diff --git a/maintenance/hhvm/makeRepo.php b/maintenance/hhvm/makeRepo.php
index c1aa082..3a41813 100644
--- a/maintenance/hhvm/makeRepo.php
+++ b/maintenance/hhvm/makeRepo.php
@@ -97,7 +97,7 @@
 
                $tmpDir = wfTempDir() . '/mw-make-repo' . mt_rand( 0, 1 << 31 );
                if ( !mkdir( $tmpDir ) ) {
-                       $this->error( 'Unable to create temporary directory', 1 
);
+                       $this->die( 'Unable to create temporary directory' );
                }
                file_put_contents( "$tmpDir/file-list", implode( "\n", $files ) 
);
 
@@ -119,11 +119,11 @@
                passthru( $cmd, $ret );
                if ( $ret ) {
                        $this->cleanupTemp( $tmpDir );
-                       $this->error( "Error: HHVM returned error code $ret", 1 
);
+                       $this->die( "Error: HHVM returned error code $ret" );
                }
                if ( !rename( "$tmpDir/hhvm.hhbc", $this->getOption( 'output' ) 
) ) {
                        $this->cleanupTemp( $tmpDir );
-                       $this->error( "Error: unable to rename output file", 1 
);
+                       $this->die( "Error: unable to rename output file" );
                }
                $this->cleanupTemp( $tmpDir );
                return 0;
diff --git a/maintenance/importDump.php b/maintenance/importDump.php
index 206c7ee..06f7134 100644
--- a/maintenance/importDump.php
+++ b/maintenance/importDump.php
@@ -87,7 +87,7 @@
 
        public function execute() {
                if ( wfReadOnly() ) {
-                       $this->error( "Wiki is in read-only mode; you'll need 
to disable it for import to work.", true );
+                       $this->die( "Wiki is in read-only mode; you'll need to 
disable it for import to work." );
                }
 
                $this->reportingInterval = intval( $this->getOption( 'report', 
100 ) );
@@ -134,7 +134,7 @@
                if ( strval( $ns ) === $namespace && $wgContLang->getNsText( 
$ns ) !== false ) {
                        return $ns;
                }
-               $this->error( "Unknown namespace text / index specified: 
$namespace", true );
+               $this->die( "Unknown namespace text / index specified: 
$namespace" );
        }
 
        /**
@@ -299,7 +299,7 @@
                        $statusRootPage = $importer->setTargetRootPage( 
$this->getOption( 'rootpage' ) );
                        if ( !$statusRootPage->isGood() ) {
                                // Die here so that it doesn't print "Done!"
-                               $this->error( 
$statusRootPage->getMessage()->text(), 1 );
+                               $this->die( 
$statusRootPage->getMessage()->text() );
                                return false;
                        }
                }
diff --git a/maintenance/importImages.php b/maintenance/importImages.php
index e733b9a..542b94c 100644
--- a/maintenance/importImages.php
+++ b/maintenance/importImages.php
@@ -133,11 +133,11 @@
 
                # Check Protection
                if ( $this->hasOption( 'protect' ) && $this->hasOption( 
'unprotect' ) ) {
-                       $this->error( "Cannot specify both protect and 
unprotect.  Only 1 is allowed.\n", 1 );
+                       $this->die( "Cannot specify both protect and unprotect. 
 Only 1 is allowed.\n" );
                }
 
                if ( $this->hasOption( 'protect' ) && trim( $this->getOption( 
'protect' ) ) ) {
-                       $this->error( "You must specify a protection 
option.\n", 1 );
+                       $this->die( "You must specify a protection option.\n" );
                }
 
                # Prepare the list of allowed extensions
@@ -170,7 +170,7 @@
                if ( $commentFile !== null ) {
                        $comment = file_get_contents( $commentFile );
                        if ( $comment === false || $comment === null ) {
-                               $this->error( "failed to read comment file: 
{$commentFile}\n", 1 );
+                               $this->die( "failed to read comment file: 
{$commentFile}\n" );
                        }
                } else {
                        $comment = $this->getOption( 'comment', 'Importing 
file' );
diff --git a/maintenance/importTextFiles.php b/maintenance/importTextFiles.php
index 816e745..bdf376f 100644
--- a/maintenance/importTextFiles.php
+++ b/maintenance/importTextFiles.php
@@ -73,7 +73,7 @@
                                        $files[$filename] = file_get_contents( 
$filename );
                                }
                                if ( !$found ) {
-                                       $this->error( "Fatal error: The file 
'$arg' does not exist!", 1 );
+                                       $this->die( "Fatal error: The file 
'$arg' does not exist!" );
                                }
                        }
                };
@@ -88,7 +88,7 @@
                }
 
                if ( !$user ) {
-                       $this->error( "Invalid username\n", true );
+                       $this->die( "Invalid username\n" );
                }
                if ( $user->isAnon() ) {
                        $user->addToDatabase();
@@ -199,7 +199,7 @@
 
                $this->output( "Done! $successCount succeeded, $skipCount 
skipped.\n" );
                if ( $exit ) {
-                       $this->error( "Import failed with $failCount failed 
pages.\n", $exit );
+                       $this->die( "Import failed with $failCount failed 
pages.\n", $exit );
                }
        }
 }
diff --git a/maintenance/install.php b/maintenance/install.php
index cac3009..4bcce71 100644
--- a/maintenance/install.php
+++ b/maintenance/install.php
@@ -136,7 +136,7 @@
                        $dbpass = file_get_contents( $dbpassfile ); // returns 
false on failure
                        MediaWiki\restoreWarnings();
                        if ( $dbpass === false ) {
-                               $this->error( "Couldn't open $dbpassfile", true 
);
+                               $this->die( "Couldn't open $dbpassfile" );
                        }
                        $this->mOptions['dbpass'] = trim( $dbpass, "\r\n" );
                }
@@ -153,11 +153,11 @@
                        $pass = file_get_contents( $passfile ); // returns 
false on failure
                        MediaWiki\restoreWarnings();
                        if ( $pass === false ) {
-                               $this->error( "Couldn't open $passfile", true );
+                               $this->die( "Couldn't open $passfile" );
                        }
                        $this->mOptions['pass'] = trim( $pass, "\r\n" );
                } elseif ( $this->getOption( 'pass' ) === null ) {
-                       $this->error( 'You need to provide the option "pass" or 
"passfile"', true );
+                       $this->die( 'You need to provide the option "pass" or 
"passfile"' );
                }
        }
 
diff --git a/maintenance/invalidateUserSessions.php 
b/maintenance/invalidateUserSessions.php
index 8f67acd..49e2c3d 100644
--- a/maintenance/invalidateUserSessions.php
+++ b/maintenance/invalidateUserSessions.php
@@ -49,9 +49,9 @@
                $file = $this->getOption( 'file' );
 
                if ( $username === null && $file === null ) {
-                       $this->error( 'Either --user or --file is required', 1 
);
+                       $this->die( 'Either --user or --file is required' );
                } elseif ( $username !== null && $file !== null ) {
-                       $this->error( 'Cannot use both --user and --file', 1 );
+                       $this->die( 'Cannot use both --user and --file' );
                }
 
                if ( $username !== null ) {
@@ -60,7 +60,7 @@
                        $usernames = is_readable( $file ) ?
                                file( $file, FILE_IGNORE_NEW_LINES | 
FILE_SKIP_EMPTY_LINES ) : false;
                        if ( $usernames === false ) {
-                               $this->error( "Could not open $file", 2 );
+                               $this->die( "Could not open $file", 2 );
                        }
                }
 
diff --git a/maintenance/language/generateCollationData.php 
b/maintenance/language/generateCollationData.php
index ccfece0..fae50ce 100644
--- a/maintenance/language/generateCollationData.php
+++ b/maintenance/language/generateCollationData.php
@@ -131,16 +131,14 @@
                                $error .= "* $ucdallURL\n";
                        }
 
-                       $this->error( $error );
-                       exit( 1 );
+                       $this->die( $error );
                }
 
                $debugOutFileName = $this->getOption( 'debug-output' );
                if ( $debugOutFileName ) {
                        $this->debugOutFile = fopen( $debugOutFileName, 'w' );
                        if ( !$this->debugOutFile ) {
-                               $this->error( "Unable to open debug output file 
for writing" );
-                               exit( 1 );
+                               $this->die( "Unable to open debug output file 
for writing" );
                        }
                }
                $this->loadUcd();
@@ -205,14 +203,12 @@
        function generateFirstChars() {
                $file = fopen( "{$this->dataDir}/allkeys.txt", 'r' );
                if ( !$file ) {
-                       $this->error( "Unable to open allkeys.txt" );
-                       exit( 1 );
+                       $this->die( "Unable to open allkeys.txt" );
                }
                global $IP;
                $outFile = fopen( "$IP/serialized/first-letters-root.ser", 'w' 
);
                if ( !$outFile ) {
-                       $this->error( "Unable to open output file 
first-letters-root.ser" );
-                       exit( 1 );
+                       $this->die( "Unable to open output file 
first-letters-root.ser" );
                }
 
                $goodTertiaryChars = [];
diff --git a/maintenance/language/generateNormalizerDataAr.php 
b/maintenance/language/generateNormalizerDataAr.php
index 34903de..85b99f6 100644
--- a/maintenance/language/generateNormalizerDataAr.php
+++ b/maintenance/language/generateNormalizerDataAr.php
@@ -46,22 +46,19 @@
                if ( !$this->hasOption( 'unicode-data-file' ) ) {
                        $dataFile = 'UnicodeData.txt';
                        if ( !file_exists( $dataFile ) ) {
-                               $this->error( "Unable to find UnicodeData.txt. 
Please specify " .
+                               $this->die( "Unable to find UnicodeData.txt. 
Please specify " .
                                        "its location with 
--unicode-data-file=<FILE>" );
-                               exit( 1 );
                        }
                } else {
                        $dataFile = $this->getOption( 'unicode-data-file' );
                        if ( !file_exists( $dataFile ) ) {
-                               $this->error( 'Unable to find the specified 
data file.' );
-                               exit( 1 );
+                               $this->die( 'Unable to find the specified data 
file.' );
                        }
                }
 
                $file = fopen( $dataFile, 'r' );
                if ( !$file ) {
-                       $this->error( 'Unable to open the data file.' );
-                       exit( 1 );
+                       $this->die( 'Unable to open the data file.' );
                }
 
                // For the file format, see http://www.unicode.org/reports/tr44/
diff --git a/maintenance/language/langmemusage.php 
b/maintenance/language/langmemusage.php
index 7c16602..a7ad224 100644
--- a/maintenance/language/langmemusage.php
+++ b/maintenance/language/langmemusage.php
@@ -40,7 +40,7 @@
 
        public function execute() {
                if ( !function_exists( 'memory_get_usage' ) ) {
-                       $this->error( "You must compile PHP with 
--enable-memory-limit", true );
+                       $this->die( "You must compile PHP with 
--enable-memory-limit" );
                }
 
                $langtool = new Languages();
diff --git a/maintenance/makeTestEdits.php b/maintenance/makeTestEdits.php
index 1effb61..b58e8bb 100644
--- a/maintenance/makeTestEdits.php
+++ b/maintenance/makeTestEdits.php
@@ -40,7 +40,7 @@
        public function execute() {
                $user = User::newFromName( $this->getOption( 'user' ) );
                if ( !$user->getId() ) {
-                       $this->error( "No such user exists.", 1 );
+                       $this->die( "No such user exists." );
                }
 
                $count = $this->getOption( 'count' );
diff --git a/maintenance/manageJobs.php b/maintenance/manageJobs.php
index 5f39a3d..bfa75dd 100644
--- a/maintenance/manageJobs.php
+++ b/maintenance/manageJobs.php
@@ -48,7 +48,7 @@
                } elseif ( $action === 'repush-abandoned' ) {
                        $this->repushAbandoned( $queue );
                } else {
-                       $this->error( "Invalid action '$action'.", 1 );
+                       $this->die( "Invalid action '$action'." );
                }
        }
 
diff --git a/maintenance/mctest.php b/maintenance/mctest.php
index 60f94a5..cb95ba3 100644
--- a/maintenance/mctest.php
+++ b/maintenance/mctest.php
@@ -47,7 +47,7 @@
                $iterations = $this->getOption( 'i', 100 );
                if ( $cache ) {
                        if ( !isset( $wgObjectCaches[$cache] ) ) {
-                               $this->error( "MediaWiki isn't configured with 
a cache named '$cache'", 1 );
+                               $this->die( "MediaWiki isn't configured with a 
cache named '$cache'" );
                        }
                        $servers = $wgObjectCaches[$cache]['servers'];
                } elseif ( $this->hasArg() ) {
@@ -58,7 +58,7 @@
                } elseif ( isset( $wgObjectCaches[$wgMainCacheType]['servers'] 
) ) {
                        $servers = $wgObjectCaches[$wgMainCacheType]['servers'];
                } else {
-                       $this->error( "MediaWiki isn't configured for Memcached 
usage", 1 );
+                       $this->die( "MediaWiki isn't configured for Memcached 
usage" );
                }
 
                # find out the longest server string to nicely align output 
later on
diff --git a/maintenance/mergeMessageFileList.php 
b/maintenance/mergeMessageFileList.php
index 8d2534e..8b8eba3 100644
--- a/maintenance/mergeMessageFileList.php
+++ b/maintenance/mergeMessageFileList.php
@@ -61,8 +61,8 @@
                        && !$this->hasOption( 'list-file' )
                        && !$this->hasOption( 'extensions-dir' )
                ) {
-                       $this->error( "Either --list-file or --extensions-dir 
must be provided if " .
-                               "\$wgExtensionEntryPointListFiles is not set", 
1 );
+                       $this->die( "Either --list-file or --extensions-dir 
must be provided if " .
+                               "\$wgExtensionEntryPointListFiles is not set" );
                }
 
                $mmfl = [ 'setupFiles' => [] ];
diff --git a/maintenance/migrateFileRepoLayout.php 
b/maintenance/migrateFileRepoLayout.php
index b2cce3e..a8a9bd6 100644
--- a/maintenance/migrateFileRepoLayout.php
+++ b/maintenance/migrateFileRepoLayout.php
@@ -43,11 +43,11 @@
        public function execute() {
                $oldLayout = $this->getOption( 'oldlayout' );
                if ( !in_array( $oldLayout, [ 'name', 'sha1' ] ) ) {
-                       $this->error( "Invalid old layout.", 1 );
+                       $this->die( "Invalid old layout." );
                }
                $newLayout = $this->getOption( 'newlayout' );
                if ( !in_array( $newLayout, [ 'name', 'sha1' ] ) ) {
-                       $this->error( "Invalid new layout.", 1 );
+                       $this->die( "Invalid new layout." );
                }
                $since = $this->getOption( 'since' );
 
diff --git a/maintenance/migrateUserGroup.php b/maintenance/migrateUserGroup.php
index ad82542..c2b9ea4 100644
--- a/maintenance/migrateUserGroup.php
+++ b/maintenance/migrateUserGroup.php
@@ -48,7 +48,7 @@
                $end = $dbw->selectField( 'user_groups', 'MAX(ug_user)',
                        [ 'ug_group' => $oldGroup ], __FUNCTION__ );
                if ( $start === null ) {
-                       $this->error( "Nothing to do - no users in the 
'$oldGroup' group", true );
+                       $this->die( "Nothing to do - no users in the 
'$oldGroup' group" );
                }
                # Do remaining chunk
                $end += $batchSize - 1;
diff --git a/maintenance/minify.php b/maintenance/minify.php
index 16e4d1c..5841460 100644
--- a/maintenance/minify.php
+++ b/maintenance/minify.php
@@ -48,14 +48,12 @@
 
        public function execute() {
                if ( !count( $this->mArgs ) ) {
-                       $this->error( "minify.php: At least one input file must 
be specified." );
-                       exit( 1 );
+                       $this->die( "minify.php: At least one input file must 
be specified." );
                }
 
                if ( $this->hasOption( 'outfile' ) ) {
                        if ( count( $this->mArgs ) > 1 ) {
-                               $this->error( '--outfile may only be used with 
a single input file.' );
-                               exit( 1 );
+                               $this->die( '--outfile may only be used with a 
single input file.' );
                        }
 
                        // Minify one file
@@ -77,7 +75,7 @@
                        }
 
                        if ( !file_exists( $inPath ) ) {
-                               $this->error( "File does not exist: $arg", true 
);
+                               $this->die( "File does not exist: $arg" );
                        }
 
                        $extension = $this->getExtension( $inName );
@@ -95,8 +93,7 @@
        public function getExtension( $fileName ) {
                $dotPos = strrpos( $fileName, '.' );
                if ( $dotPos === false ) {
-                       $this->error( "No file extension, cannot determine 
type: $fileName" );
-                       exit( 1 );
+                       $this->die( "No file extension, cannot determine type: 
$fileName" );
                }
 
                return substr( $fileName, $dotPos + 1 );
@@ -108,13 +105,11 @@
 
                $inText = file_get_contents( $inPath );
                if ( $inText === false ) {
-                       $this->error( "Unable to open file $inPath for 
reading." );
-                       exit( 1 );
+                       $this->die( "Unable to open file $inPath for reading." 
);
                }
                $outFile = fopen( $outPath, 'w' );
                if ( !$outFile ) {
-                       $this->error( "Unable to open file $outPath for 
writing." );
-                       exit( 1 );
+                       $this->die( "Unable to open file $outPath for writing." 
);
                }
 
                switch ( $extension ) {
diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php
index d578a49..7c43241 100644
--- a/maintenance/moveBatch.php
+++ b/maintenance/moveBatch.php
@@ -73,7 +73,7 @@
 
                # Setup
                if ( !$file ) {
-                       $this->error( "Unable to read file, exiting", true );
+                       $this->die( "Unable to read file, exiting" );
                }
                if ( $user === false ) {
                        $wgUser = User::newSystemUser( 'Move page script', [ 
'steal' => true ] );
@@ -81,7 +81,7 @@
                        $wgUser = User::newFromName( $user );
                }
                if ( !$wgUser ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
 
                # Setup complete, now start
diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php
index 43041a43d..67a02b4 100644
--- a/maintenance/mwdocgen.php
+++ b/maintenance/mwdocgen.php
@@ -138,8 +138,7 @@
 
                $tmpFile = tempnam( wfTempDir(), 'MWDocGen-' );
                if ( file_put_contents( $tmpFile, $conf ) === false ) {
-                       $this->error( "Could not write doxygen configuration to 
file $tmpFile\n",
-                               /** exit code: */ 1 );
+                       $this->die( "Could not write doxygen configuration to 
file $tmpFile\n" );
                }
 
                $command = $this->doxygen . ' ' . $tmpFile;
@@ -161,8 +160,7 @@
                );
 
                if ( $exitcode !== 0 ) {
-                       $this->error( "Something went wrong (exit: 
$exitcode)\n",
-                               $exitcode );
+                       $this->die( "Something went wrong (exit: $exitcode)\n", 
$exitcode );
                }
        }
 }
diff --git a/maintenance/pageExists.php b/maintenance/pageExists.php
index b631005..24ec8cb 100644
--- a/maintenance/pageExists.php
+++ b/maintenance/pageExists.php
@@ -45,7 +45,7 @@
                        $code = 1;
                }
                $this->output( $text );
-               $this->error( '', $code );
+               exit( $code );
        }
 }
 
diff --git a/maintenance/populateContentModel.php 
b/maintenance/populateContentModel.php
index 7cc829d..d851b5f 100644
--- a/maintenance/populateContentModel.php
+++ b/maintenance/populateContentModel.php
@@ -51,7 +51,7 @@
 
                $ns = $this->getOption( 'ns' );
                if ( !ctype_digit( $ns ) && $ns !== 'all' ) {
-                       $this->error( 'Invalid namespace', 1 );
+                       $this->die( 'Invalid namespace' );
                }
                $ns = $ns === 'all' ? 'all' : (int)$ns;
                $table = $this->getOption( 'table' );
@@ -64,7 +64,7 @@
                                $this->populatePage( $dbw, $ns );
                                break;
                        default:
-                               $this->error( "Invalid table name: $table", 1 );
+                               $this->die( "Invalid table name: $table" );
                }
        }
 
diff --git a/maintenance/populateImageSha1.php 
b/maintenance/populateImageSha1.php
index 2735a1e..999d8ea 100644
--- a/maintenance/populateImageSha1.php
+++ b/maintenance/populateImageSha1.php
@@ -76,9 +76,7 @@
                                __METHOD__
                        );
                        if ( !$res ) {
-                               $this->error( "No such file: $file", true );
-
-                               return false;
+                               $this->die( "No such file: $file" );
                        }
                        $this->output( "Populating img_sha1 field for specified 
files\n" );
                } else {
diff --git a/maintenance/populateRevisionLength.php 
b/maintenance/populateRevisionLength.php
index 5de5819..348fb0a 100644
--- a/maintenance/populateRevisionLength.php
+++ b/maintenance/populateRevisionLength.php
@@ -44,9 +44,9 @@
        public function doDBUpdates() {
                $dbw = $this->getDB( DB_MASTER );
                if ( !$dbw->tableExists( 'revision' ) ) {
-                       $this->error( "revision table does not exist", true );
+                       $this->die( "revision table does not exist" );
                } elseif ( !$dbw->tableExists( 'archive' ) ) {
-                       $this->error( "archive table does not exist", true );
+                       $this->die( "archive table does not exist" );
                } elseif ( !$dbw->fieldExists( 'revision', 'rev_len', 
__METHOD__ ) ) {
                        $this->output( "rev_len column does not exist\n\n", 
true );
 
diff --git a/maintenance/populateRevisionSha1.php 
b/maintenance/populateRevisionSha1.php
index 89eff02..9cab2c2 100644
--- a/maintenance/populateRevisionSha1.php
+++ b/maintenance/populateRevisionSha1.php
@@ -45,9 +45,9 @@
                $db = $this->getDB( DB_MASTER );
 
                if ( !$db->tableExists( 'revision' ) ) {
-                       $this->error( "revision table does not exist", true );
+                       $this->die( "revision table does not exist" );
                } elseif ( !$db->tableExists( 'archive' ) ) {
-                       $this->error( "archive table does not exist", true );
+                       $this->die( "archive table does not exist" );
                } elseif ( !$db->fieldExists( 'revision', 'rev_sha1', 
__METHOD__ ) ) {
                        $this->output( "rev_sha1 column does not exist\n\n", 
true );
 
diff --git a/maintenance/protect.php b/maintenance/protect.php
index f6bb253..ee26aea8 100644
--- a/maintenance/protect.php
+++ b/maintenance/protect.php
@@ -59,7 +59,7 @@
                        $user = User::newFromName( $userName );
                }
                if ( !$user ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
 
                // @todo FIXME: This is reset 7 lines down.
@@ -67,7 +67,7 @@
 
                $t = Title::newFromText( $this->getArg() );
                if ( !$t ) {
-                       $this->error( "Invalid title", true );
+                       $this->die( "Invalid title" );
                }
 
                $restrictions = [];
diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php
index 8e6978d..3354ffa 100644
--- a/maintenance/pruneFileCache.php
+++ b/maintenance/pruneFileCache.php
@@ -43,25 +43,25 @@
                global $wgUseFileCache, $wgFileCacheDirectory;
 
                if ( !$wgUseFileCache ) {
-                       $this->error( "Nothing to do -- \$wgUseFileCache is 
disabled.", true );
+                       $this->die( "Nothing to do -- \$wgUseFileCache is 
disabled." );
                }
 
                $age = $this->getOption( 'agedays' );
                if ( !ctype_digit( $age ) ) {
-                       $this->error( "Non-integer 'age' parameter given.", 
true );
+                       $this->die( "Non-integer 'age' parameter given." );
                }
                // Delete items with a TS older than this
                $this->minSurviveTimestamp = time() - ( 86400 * $age );
 
                $dir = $wgFileCacheDirectory;
                if ( !is_dir( $dir ) ) {
-                       $this->error( "Nothing to do -- \$wgFileCacheDirectory 
directory not found.", true );
+                       $this->die( "Nothing to do -- \$wgFileCacheDirectory 
directory not found." );
                }
 
                $subDir = $this->getOption( 'subdir' );
                if ( $subDir !== null ) {
                        if ( !is_dir( "$dir/$subDir" ) ) {
-                               $this->error( "The specified subdirectory 
`$subDir` does not exist.", true );
+                               $this->die( "The specified subdirectory 
`$subDir` does not exist." );
                        }
                        $this->output( "Pruning `$dir/$subDir` directory...\n" 
);
                        $this->prune_directory( "$dir/$subDir", 'report' );
diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php
index da2d850..450709a 100644
--- a/maintenance/purgeParserCache.php
+++ b/maintenance/purgeParserCache.php
@@ -60,7 +60,7 @@
                } elseif ( $inputAge !== null ) {
                        $date = wfTimestamp( TS_MW, time() + 
$wgParserCacheExpireTime - intval( $inputAge ) );
                } else {
-                       $this->error( "Must specify either --expiredate or 
--age", 1 );
+                       $this->die( "Must specify either --expiredate or --age" 
);
                        return;
                }
                $this->usleep = 1e3 * $this->getOption( 'msleep', 0 );
@@ -72,7 +72,7 @@
                $pc = 
MediaWikiServices::getInstance()->getParserCache()->getCacheStorage();
                $success = $pc->deleteObjectsExpiringBefore( $date, [ $this, 
'showProgressAndWait' ] );
                if ( !$success ) {
-                       $this->error( "\nCannot purge this kind of parser 
cache.", 1 );
+                       $this->die( "\nCannot purge this kind of parser cache." 
);
                }
                $this->showProgressAndWait( 100 );
                $this->output( "\nDone\n" );
diff --git a/maintenance/reassignEdits.php b/maintenance/reassignEdits.php
index 7a0e4fc..97c6117 100644
--- a/maintenance/reassignEdits.php
+++ b/maintenance/reassignEdits.php
@@ -186,7 +186,7 @@
                } else {
                        $user = User::newFromName( $username );
                        if ( !$user ) {
-                               $this->error( "Invalid username", true );
+                               $this->die( "Invalid username" );
                        }
                }
                $user->load();
diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php
index 19d8d06..7c9664a 100644
--- a/maintenance/rebuildFileCache.php
+++ b/maintenance/rebuildFileCache.php
@@ -60,18 +60,18 @@
                global $wgRequestTime;
 
                if ( !$this->enabled ) {
-                       $this->error( "Nothing to do -- \$wgUseFileCache is 
disabled.", true );
+                       $this->die( "Nothing to do -- \$wgUseFileCache is 
disabled." );
                }
 
                $start = $this->getOption( 'start', "0" );
                if ( !ctype_digit( $start ) ) {
-                       $this->error( "Invalid value for start parameter.", 
true );
+                       $this->die( "Invalid value for start parameter." );
                }
                $start = intval( $start );
 
                $end = $this->getOption( 'end', "0" );
                if ( !ctype_digit( $end ) ) {
-                       $this->error( "Invalid value for end parameter.", true 
);
+                       $this->die( "Invalid value for end parameter." );
                }
                $end = intval( $end );
 
@@ -87,7 +87,7 @@
                        ? $end
                        : $dbr->selectField( 'page', 'MAX(page_id)', false, 
__METHOD__ );
                if ( !$start ) {
-                       $this->error( "Nothing to do.", true );
+                       $this->die( "Nothing to do." );
                }
 
                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'bgzip'; // hack, no real 
client
diff --git a/maintenance/rebuildLocalisationCache.php 
b/maintenance/rebuildLocalisationCache.php
index 48602de..dbaba8e 100644
--- a/maintenance/rebuildLocalisationCache.php
+++ b/maintenance/rebuildLocalisationCache.php
@@ -92,7 +92,7 @@
                                explode( ',', $this->getOption( 'lang' ) ) );
                        # Bailed out if nothing is left
                        if ( count( $codes ) == 0 ) {
-                               $this->error( 'None of the languages specified 
exists.', 1 );
+                               $this->die( 'None of the languages specified 
exists.' );
                        }
                } else {
                        # By default get all languages
diff --git a/maintenance/rebuildSitesCache.php 
b/maintenance/rebuildSitesCache.php
index 230e86d..4dfe7a9 100644
--- a/maintenance/rebuildSitesCache.php
+++ b/maintenance/rebuildSitesCache.php
@@ -55,7 +55,7 @@
                        $jsonFile = $this->getConfig()->get( 'SitesCacheFile' );
 
                        if ( $jsonFile === false ) {
-                               $this->error( 'Error: No file set in 
configuration for SitesCacheFile.', 1 );
+                               $this->die( 'Error: No file set in 
configuration for SitesCacheFile.' );
                        }
                }
 
diff --git a/maintenance/rebuildrecentchanges.php 
b/maintenance/rebuildrecentchanges.php
index 6d4a4bf..1b0088d 100644
--- a/maintenance/rebuildrecentchanges.php
+++ b/maintenance/rebuildrecentchanges.php
@@ -61,7 +61,7 @@
                        ( $this->hasOption( 'from' ) && !$this->hasOption( 'to' 
) ) ||
                        ( !$this->hasOption( 'from' ) && $this->hasOption( 'to' 
) )
                ) {
-                       $this->error( "Both 'from' and 'to' must be given, or 
neither", 1 );
+                       $this->die( "Both 'from' and 'to' must be given, or 
neither" );
                }
 
                $this->rebuildRecentChangesTablePass1();
diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php
index 5971d5e..d4d0e9c 100644
--- a/maintenance/rebuildtextindex.php
+++ b/maintenance/rebuildtextindex.php
@@ -56,17 +56,17 @@
                // Shouldn't be needed for Postgres
                $this->db = $this->getDB( DB_MASTER );
                if ( $this->db->getType() == 'postgres' ) {
-                       $this->error( "This script is not needed when using 
Postgres.\n", true );
+                       $this->die( "This script is not needed when using 
Postgres.\n" );
                }
 
                if ( $this->db->getType() == 'sqlite' ) {
                        if ( !DatabaseSqlite::getFulltextSearchModule() ) {
-                               $this->error( "Your version of SQLite module 
for PHP doesn't "
-                                       . "support full-text search (FTS3).\n", 
true );
+                               $this->die( "Your version of SQLite module for 
PHP doesn't "
+                                       . "support full-text search (FTS3).\n" 
);
                        }
                        if ( !$this->db->checkForEnabledSearch() ) {
-                               $this->error( "Your database schema is not 
configured for "
-                                       . "full-text search support. Run 
update.php.\n", true );
+                               $this->die( "Your database schema is not 
configured for "
+                                       . "full-text search support. Run 
update.php.\n" );
                        }
                }
 
diff --git a/maintenance/recountCategories.php 
b/maintenance/recountCategories.php
index b4d75c7..20b3dce 100644
--- a/maintenance/recountCategories.php
+++ b/maintenance/recountCategories.php
@@ -75,7 +75,7 @@
        public function execute() {
                $this->mode = $this->getOption( 'mode' );
                if ( !in_array( $this->mode, [ 'pages', 'subcats', 'files' ] ) 
) {
-                       $this->error( 'Please specify a valid mode: one of 
"pages", "subcats" or "files".', 1 );
+                       $this->die( 'Please specify a valid mode: one of 
"pages", "subcats" or "files".' );
                }
 
                $this->minimumId = intval( $this->getOption( 'begin', 0 ) );
diff --git a/maintenance/refreshImageMetadata.php 
b/maintenance/refreshImageMetadata.php
index f6c0673..8ff59d4 100644
--- a/maintenance/refreshImageMetadata.php
+++ b/maintenance/refreshImageMetadata.php
@@ -108,7 +108,7 @@
                $dbw = $this->getDB( DB_MASTER );
                $batchSize = $this->getBatchSize();
                if ( $batchSize <= 0 ) {
-                       $this->error( "Batch size is too low...", 12 );
+                       $this->die( "Batch size is too low...", 12 );
                }
 
                $repo = RepoGroup::singleton()->getLocalRepo();
@@ -255,7 +255,7 @@
                }
 
                if ( $brokenOnly && $force ) {
-                       $this->error( 'Cannot use --broken-only and --force 
together. ', 2 );
+                       $this->die( 'Cannot use --broken-only and --force 
together. ', 2 );
                }
        }
 }
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index cea9e0c..c03017d 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -70,7 +70,7 @@
                if ( ( $category = $this->getOption( 'category', false ) ) !== 
false ) {
                        $title = Title::makeTitleSafe( NS_CATEGORY, $category );
                        if ( !$title ) {
-                               $this->error( "'$category' is an invalid 
category name!\n", true );
+                               $this->die( "'$category' is an invalid category 
name!\n" );
                        }
                        $this->refreshCategory( $title );
                } elseif ( ( $category = $this->getOption( 'tracking-category', 
false ) ) !== false ) {
@@ -485,7 +485,7 @@
                if ( isset( $cats[$categoryKey] ) ) {
                        return $cats[$categoryKey]['cats'];
                }
-               $this->error( "Unknown tracking category {$categoryKey}\n", 
true );
+               $this->die( "Unknown tracking category {$categoryKey}\n" );
        }
 }
 
diff --git a/maintenance/removeUnusedAccounts.php 
b/maintenance/removeUnusedAccounts.php
index c750784..b90fab5 100644
--- a/maintenance/removeUnusedAccounts.php
+++ b/maintenance/removeUnusedAccounts.php
@@ -53,7 +53,7 @@
                }
                $touched = $this->getOption( 'ignore-touched', "1" );
                if ( !ctype_digit( $touched ) ) {
-                       $this->error( "Please put a valid positive integer on 
the --ignore-touched parameter.", true );
+                       $this->die( "Please put a valid positive integer on the 
--ignore-touched parameter." );
                }
                $touchedSeconds = 86400 * $touched;
                foreach ( $res as $row ) {
diff --git a/maintenance/renameDbPrefix.php b/maintenance/renameDbPrefix.php
index 2772f04..a1d63a0 100644
--- a/maintenance/renameDbPrefix.php
+++ b/maintenance/renameDbPrefix.php
@@ -62,7 +62,7 @@
                }
 
                if ( $old === false || $new === false ) {
-                       $this->error( "Invalid prefix!", true );
+                       $this->die( "Invalid prefix!" );
                }
                if ( $old === $new ) {
                        $this->output( "Same prefix. Nothing to rename!\n", 
true );
diff --git a/maintenance/resetUserEmail.php b/maintenance/resetUserEmail.php
index 8d0873f..a19d607 100644
--- a/maintenance/resetUserEmail.php
+++ b/maintenance/resetUserEmail.php
@@ -48,12 +48,12 @@
                        $user = User::newFromName( $userName );
                }
                if ( !$user || !$user->getId() || !$user->loadFromId() ) {
-                       $this->error( "Error: user '$userName' does not 
exist\n", 1 );
+                       $this->die( "Error: user '$userName' does not exist\n" 
);
                }
 
                $email = $this->getArg( 1 );
                if ( !Sanitizer::validateEmail( $email ) ) {
-                       $this->error( "Error: email '$email' is not valid\n", 1 
);
+                       $this->die( "Error: email '$email' is not valid\n" );
                }
 
                // Code from https://wikitech.wikimedia.org/wiki/Password_reset
diff --git a/maintenance/rollbackEdits.php b/maintenance/rollbackEdits.php
index 5ad7d4e..65b8fc1 100644
--- a/maintenance/rollbackEdits.php
+++ b/maintenance/rollbackEdits.php
@@ -50,7 +50,7 @@
                $user = $this->getOption( 'user' );
                $username = User::isIP( $user ) ? $user : 
User::getCanonicalName( $user );
                if ( !$username ) {
-                       $this->error( 'Invalid username', true );
+                       $this->die( 'Invalid username' );
                }
 
                $bot = $this->hasOption( 'bot' );
diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php
index af2a318..63f58b8 100644
--- a/maintenance/runJobs.php
+++ b/maintenance/runJobs.php
@@ -59,7 +59,7 @@
                if ( $this->hasOption( 'procs' ) ) {
                        $procs = intval( $this->getOption( 'procs' ) );
                        if ( $procs < 1 || $procs > 1000 ) {
-                               $this->error( "Invalid argument to --procs", 
true );
+                               $this->die( "Invalid argument to --procs" );
                        } elseif ( $procs != 1 ) {
                                $fc = new ForkController( $procs );
                                if ( $fc->start() != 'child' ) {
diff --git a/maintenance/shell.php b/maintenance/shell.php
index 65c353a..779c183 100644
--- a/maintenance/shell.php
+++ b/maintenance/shell.php
@@ -58,7 +58,7 @@
 
        public function execute() {
                if ( !class_exists( \Psy\Shell::class ) ) {
-                       $this->error( 'PsySH not found. Please run composer 
with the --dev option.', 1 );
+                       $this->die( 'PsySH not found. Please run composer with 
the --dev option.' );
                }
 
                $traverser = new \PhpParser\NodeTraverser();
diff --git a/maintenance/sql.php b/maintenance/sql.php
index 36e55f3..ea04517 100644
--- a/maintenance/sql.php
+++ b/maintenance/sql.php
@@ -72,7 +72,7 @@
                                }
                        }
                        if ( $index === null ) {
-                               $this->error( "No replica DB server configured 
with the name '$replicaDB'.", 1 );
+                               $this->die( "No replica DB server configured 
with the name '$replicaDB'." );
                        }
                } else {
                        $index = DB_MASTER;
@@ -81,7 +81,7 @@
                /** @var IDatabase $db DB handle for the appropriate 
cluster/wiki */
                $db = $lb->getConnection( $index, [], $wiki );
                if ( $replicaDB != '' && $db->getLBInfo( 'master' ) !== null ) {
-                       $this->error( "The server selected ({$db->getServer()}) 
is not a replica DB.", 1 );
+                       $this->die( "The server selected ({$db->getServer()}) 
is not a replica DB." );
                }
 
                if ( $index === DB_MASTER ) {
@@ -92,12 +92,12 @@
                if ( $this->hasArg( 0 ) ) {
                        $file = fopen( $this->getArg( 0 ), 'r' );
                        if ( !$file ) {
-                               $this->error( "Unable to open input file", true 
);
+                               $this->die( "Unable to open input file" );
                        }
 
                        $error = $db->sourceStream( $file, null, [ $this, 
'sqlPrintResult' ] );
                        if ( $error !== true ) {
-                               $this->error( $error, true );
+                               $this->die( $error );
                        } else {
                                exit( 0 );
                        }
@@ -157,7 +157,11 @@
                        $res = $db->query( $line );
                        $this->sqlPrintResult( $res, $db );
                } catch ( DBQueryError $e ) {
-                       $this->error( $e, $dieOnError );
+                       if ( $dieOnError ) {
+                               $this->die( $e );
+                       } else {
+                               $this->error( $e );
+                       }
                }
        }
 
diff --git a/maintenance/sqlite.php b/maintenance/sqlite.php
index e74a86c..cfad73a 100644
--- a/maintenance/sqlite.php
+++ b/maintenance/sqlite.php
@@ -83,7 +83,7 @@
        private function vacuum() {
                $prevSize = filesize( $this->db->getDbFilePath() );
                if ( $prevSize == 0 ) {
-                       $this->error( "Can't vacuum an empty database.\n", true 
);
+                       $this->die( "Can't vacuum an empty database.\n" );
                }
 
                $this->output( 'VACUUM: ' );
diff --git a/maintenance/storage/checkStorage.php 
b/maintenance/storage/checkStorage.php
index 9045870..35bfa83 100644
--- a/maintenance/storage/checkStorage.php
+++ b/maintenance/storage/checkStorage.php
@@ -134,24 +134,24 @@
                                        // This is a known bug from 2004
                                        // It's safe to just erase the 
old_flags field
                                        if ( $fix ) {
-                                               $this->error( 'fixed', 
"Warning: old_flags set to 0", $id );
+                                               $this->addError( 'fixed', 
"Warning: old_flags set to 0", $id );
                                                $dbw = wfGetDB( DB_MASTER );
                                                $dbw->ping();
                                                $dbw->update( 'text', [ 
'old_flags' => '' ],
                                                        [ 'old_id' => $id ], 
__METHOD__ );
                                                echo "Fixed\n";
                                        } else {
-                                               $this->error( 'fixable', 
"Warning: old_flags set to 0", $id );
+                                               $this->addError( 'fixable', 
"Warning: old_flags set to 0", $id );
                                        }
                                } elseif ( count( array_diff( $flagArray, 
$knownFlags ) ) ) {
-                                       $this->error( 'unfixable', "Error: 
invalid flags field \"$flags\"", $id );
+                                       $this->addError( 'unfixable', "Error: 
invalid flags field \"$flags\"", $id );
                                }
                        }
                        $dbr->freeResult( $res );
 
                        // Output errors for any missing text rows
                        foreach ( $missingTextRows as $oldId => $revId ) {
-                               $this->error( 'restore revision', "Error: 
missing text row", $oldId );
+                               $this->addError( 'restore revision', "Error: 
missing text row", $oldId );
                        }
 
                        // Verify external revisions
@@ -163,12 +163,12 @@
                                foreach ( $res as $row ) {
                                        $urlParts = explode( '://', 
$row->old_text, 2 );
                                        if ( count( $urlParts ) !== 2 || 
$urlParts[1] == '' ) {
-                                               $this->error( 'restore text', 
"Error: invalid URL \"{$row->old_text}\"", $row->old_id );
+                                               $this->addError( 'restore 
text', "Error: invalid URL \"{$row->old_text}\"", $row->old_id );
                                                continue;
                                        }
                                        list( $proto, ) = $urlParts;
                                        if ( $proto != 'DB' ) {
-                                               $this->error( 'restore text', 
"Error: invalid external protocol \"$proto\"", $row->old_id );
+                                               $this->addError( 'restore 
text', "Error: invalid external protocol \"$proto\"", $row->old_id );
                                                continue;
                                        }
                                        $path = explode( '/', $row->old_text );
@@ -204,7 +204,7 @@
                                        $extDb->freeResult( $res );
                                        // Print errors for missing blobs rows
                                        foreach ( $xBlobIds as $blobId => 
$oldId ) {
-                                               $this->error( 'restore text', 
"Error: missing target $blobId for one-part ES URL", $oldId );
+                                               $this->addError( 'restore 
text', "Error: missing target $blobId for one-part ES URL", $oldId );
                                        }
                                }
                        }
@@ -225,13 +225,13 @@
                                        $oldId = $row->old_id;
                                        $matches = [];
                                        if ( !preg_match( '/^O:(\d+):"(\w+)"/', 
$row->header, $matches ) ) {
-                                               $this->error( 'restore text', 
"Error: invalid object header", $oldId );
+                                               $this->addError( 'restore 
text', "Error: invalid object header", $oldId );
                                                continue;
                                        }
 
                                        $className = strtolower( $matches[2] );
                                        if ( strlen( $className ) != 
$matches[1] ) {
-                                               $this->error(
+                                               $this->addError(
                                                        'restore text',
                                                        "Error: invalid object 
header, wrong class name length",
                                                        $oldId
@@ -249,12 +249,12 @@
                                                case 'historyblobstub':
                                                case 'historyblobcurstub':
                                                        if ( strlen( 
$row->header ) == $headerLength ) {
-                                                               $this->error( 
'unfixable', "Error: overlong stub header", $oldId );
+                                                               
$this->addError( 'unfixable', "Error: overlong stub header", $oldId );
                                                                continue;
                                                        }
                                                        $stubObj = unserialize( 
$row->header );
                                                        if ( !is_object( 
$stubObj ) ) {
-                                                               $this->error( 
'restore text', "Error: unable to unserialize stub object", $oldId );
+                                                               
$this->addError( 'restore text', "Error: unable to unserialize stub object", 
$oldId );
                                                                continue;
                                                        }
                                                        if ( $className == 
'historyblobstub' ) {
@@ -264,7 +264,7 @@
                                                        }
                                                        break;
                                                default:
-                                                       $this->error( 
'unfixable', "Error: unrecognised object class \"$className\"", $oldId );
+                                                       $this->addError( 
'unfixable', "Error: unrecognised object class \"$className\"", $oldId );
                                        }
                                }
                                $dbr->freeResult( $res );
@@ -287,7 +287,7 @@
                                                if ( in_array( 'object', $flags 
) ) {
                                                        $urlParts = explode( 
'/', $row->header );
                                                        if ( $urlParts[0] != 
'DB:' ) {
-                                                               $this->error(
+                                                               $this->addError(
                                                                        
'unfixable',
                                                                        "Error: 
unrecognised external storage type \"{$urlParts[0]}",
                                                                        
$row->old_id
@@ -303,7 +303,7 @@
                                                                );
                                                        }
                                                } else {
-                                                       $this->error(
+                                                       $this->addError(
                                                                'unfixable',
                                                                "Error: invalid 
flags \"{$row->old_flags}\" on concat bulk row {$row->old_id}",
                                                                
$concatBlobs[$row->old_id] );
@@ -312,7 +312,7 @@
                                                substr( $row->header, 0, 
strlen( self::CONCAT_HEADER ) ),
                                                self::CONCAT_HEADER
                                        ) ) {
-                                               $this->error(
+                                               $this->addError(
                                                        'restore text',
                                                        "Error: Incorrect 
object header for concat bulk row {$row->old_id}",
                                                        
$concatBlobs[$row->old_id]
@@ -357,7 +357,7 @@
                }
        }
 
-       function error( $type, $msg, $ids ) {
+       function addError( $type, $msg, $ids ) {
                if ( is_array( $ids ) && count( $ids ) == 1 ) {
                        $ids = reset( $ids );
                }
@@ -399,7 +399,7 @@
                                [ 'blob_id IN( ' . implode( ',', $blobIds ) . 
')' ], __METHOD__ );
                        foreach ( $res as $row ) {
                                if ( strcasecmp( $row->header, 
self::CONCAT_HEADER ) ) {
-                                       $this->error(
+                                       $this->addError(
                                                'restore text',
                                                "Error: invalid header on 
target $cluster/{$row->blob_id} of two-part ES URL",
                                                $oldIds[$row->blob_id]
@@ -411,7 +411,7 @@
 
                        // Print errors for missing blobs rows
                        foreach ( $oldIds as $blobId => $oldIds2 ) {
-                               $this->error(
+                               $this->addError(
                                        'restore text',
                                        "Error: missing target $cluster/$blobId 
for two-part ES URL",
                                        $oldIds2
diff --git a/maintenance/storage/compressOld.php 
b/maintenance/storage/compressOld.php
index c17ce99..44d692c 100644
--- a/maintenance/storage/compressOld.php
+++ b/maintenance/storage/compressOld.php
@@ -103,8 +103,8 @@
        public function execute() {
                global $wgDBname;
                if ( !function_exists( "gzdeflate" ) ) {
-                       $this->error( "You must enable zlib support in PHP to 
compress old revisions!\n" .
-                               "Please see 
http://www.php.net/manual/en/ref.zlib.php\n";, true );
+                       $this->die( "You must enable zlib support in PHP to 
compress old revisions!\n" .
+                               "Please see 
http://www.php.net/manual/en/ref.zlib.php\n"; );
                }
 
                $type = $this->getOption( 'type', 'concat' );
diff --git a/maintenance/storage/dumpRev.php b/maintenance/storage/dumpRev.php
index 437bfcd..9b798c5 100644
--- a/maintenance/storage/dumpRev.php
+++ b/maintenance/storage/dumpRev.php
@@ -43,7 +43,7 @@
                        [ 'old_id=rev_text_id', 'rev_id' => $this->getArg() ]
                );
                if ( !$row ) {
-                       $this->error( "Row not found", true );
+                       $this->die( "Row not found" );
                }
 
                $flags = explode( ',', $row->old_flags );
diff --git a/maintenance/storage/orphanStats.php 
b/maintenance/storage/orphanStats.php
index d7d0b84..2faad08 100644
--- a/maintenance/storage/orphanStats.php
+++ b/maintenance/storage/orphanStats.php
@@ -45,7 +45,7 @@
        public function execute() {
                $dbr = $this->getDB( DB_REPLICA );
                if ( !$dbr->tableExists( 'blob_orphans' ) ) {
-                       $this->error( "blob_orphans doesn't seem to exist, need 
to run trackBlobs.php first", true );
+                       $this->die( "blob_orphans doesn't seem to exist, need 
to run trackBlobs.php first" );
                }
                $res = $dbr->select( 'blob_orphans', '*', false, __METHOD__ );
 
diff --git a/maintenance/syncFileBackend.php b/maintenance/syncFileBackend.php
index 154f54e..99800fc 100644
--- a/maintenance/syncFileBackend.php
+++ b/maintenance/syncFileBackend.php
@@ -54,7 +54,7 @@
                if ( $this->hasOption( 'posdump' ) ) {
                        // Just dump the current position into the specified 
position dir
                        if ( !$this->hasOption( 'posdir' ) ) {
-                               $this->error( "Param posdir required!", 1 );
+                               $this->die( "Param posdir required!" );
                        }
                        if ( $this->hasOption( 'postime' ) ) {
                                $id = 
(int)$src->getJournal()->getPositionAtTime( $this->getOption( 'postime' ) );
@@ -76,7 +76,7 @@
                }
 
                if ( !$this->hasOption( 'dst' ) ) {
-                       $this->error( "Param dst required!", 1 );
+                       $this->die( "Param dst required!" );
                }
                $dst = FileBackendGroup::singleton()->get( $this->getOption( 
'dst' ) );
 
@@ -156,7 +156,7 @@
                $first = true; // first batch
 
                if ( $start > $end ) { // sanity
-                       $this->error( "Error: given starting ID greater than 
ending ID.", 1 );
+                       $this->die( "Error: given starting ID greater than 
ending ID." );
                }
 
                $next = null;
diff --git a/maintenance/undelete.php b/maintenance/undelete.php
index c2d5c2c..8c094b3 100644
--- a/maintenance/undelete.php
+++ b/maintenance/undelete.php
@@ -41,7 +41,7 @@
 
                $title = Title::newFromText( $pageName );
                if ( !$title ) {
-                       $this->error( "Invalid title", true );
+                       $this->die( "Invalid title" );
                }
                if ( $user === false ) {
                        $wgUser = User::newSystemUser( 'Command line script', [ 
'steal' => true ] );
@@ -49,7 +49,7 @@
                        $wgUser = User::newFromName( $user );
                }
                if ( !$wgUser ) {
-                       $this->error( "Invalid username", true );
+                       $this->die( "Invalid username" );
                }
                $archive = new PageArchive( $title, 
RequestContext::getMain()->getConfig() );
                $this->output( "Undeleting " . $title->getPrefixedDBkey() . 
'...' );
diff --git a/maintenance/update.php b/maintenance/update.php
index f8f5dcd..b648fd1 100755
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -66,23 +66,21 @@
 
                list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
                if ( version_compare( $pcreVersion, $minimumPcreVersion, '<' ) 
) {
-                       $this->error(
+                       $this->die(
                                "PCRE $minimumPcreVersion or later is 
required.\n" .
                                "Your PHP binary is linked with PCRE 
$pcreVersion.\n\n" .
                                "More information:\n" .
                                
"https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE\n\n"; .
-                               "ABORTING.\n",
-                               true );
+                               "ABORTING.\n" );
                }
 
                $test = new PhpXmlBugTester();
                if ( !$test->ok ) {
-                       $this->error(
+                       $this->die(
                                "Your system has a combination of PHP and 
libxml2 versions that is buggy\n" .
                                "and can cause hidden data corruption in 
MediaWiki and other web apps.\n" .
                                "Upgrade to libxml2 2.7.3 or later.\n" .
-                               "ABORTING (see 
https://bugs.php.net/bug.php?id=45996).\n",
-                               true );
+                               "ABORTING (see 
https://bugs.php.net/bug.php?id=45996).\n" );
                }
        }
 
@@ -94,22 +92,22 @@
                                || $this->hasOption( 'schema' )
                                || $this->hasOption( 'noschema' ) )
                ) {
-                       $this->error( "Do not run update.php on this wiki. If 
you're seeing this you should\n"
+                       $this->die( "Do not run update.php on this wiki. If 
you're seeing this you should\n"
                                . "probably ask for some help in performing 
your schema updates or use\n"
                                . "the --noschema and --schema options to get 
an SQL file for someone\n"
                                . "else to inspect and run.\n\n"
-                               . "If you know what you are doing, you can 
continue with --force\n", true );
+                               . "If you know what you are doing, you can 
continue with --force\n" );
                }
 
                $this->fileHandle = null;
                if ( substr( $this->getOption( 'schema' ), 0, 2 ) === "--" ) {
-                       $this->error( "The --schema option requires a file as 
an argument.\n", true );
+                       $this->die( "The --schema option requires a file as an 
argument.\n" );
                } elseif ( $this->hasOption( 'schema' ) ) {
                        $file = $this->getOption( 'schema' );
                        $this->fileHandle = fopen( $file, "w" );
                        if ( $this->fileHandle === false ) {
                                $err = error_get_last();
-                               $this->error( "Problem opening the schema file 
for writing: $file\n\t{$err['message']}", true );
+                               $this->die( "Problem opening the schema file 
for writing: $file\n\t{$err['message']}" );
                        }
                }
 
@@ -152,7 +150,7 @@
                if ( !$status->isOK() ) {
                        // This might output some wikitext like <strong> but it 
should be comprehensible
                        $text = $status->getWikiText();
-                       $this->error( $text, 1 );
+                       $this->die( $text );
                }
 
                $this->output( "Going to run database updates for " . 
wfWikiID() . "\n" );
diff --git a/maintenance/updateDoubleWidthSearch.php 
b/maintenance/updateDoubleWidthSearch.php
index cb2f125..5aad376 100644
--- a/maintenance/updateDoubleWidthSearch.php
+++ b/maintenance/updateDoubleWidthSearch.php
@@ -53,7 +53,7 @@
 
                $dbw = $this->getDB( DB_MASTER );
                if ( $dbw->getType() !== 'mysql' ) {
-                       $this->error( "This change is only needed on MySQL, 
quitting.\n", true );
+                       $this->die( "This change is only needed on MySQL, 
quitting.\n" );
                }
 
                $res = $this->findRows( $dbw );
diff --git a/maintenance/updateExtensionJsonSchema.php 
b/maintenance/updateExtensionJsonSchema.php
index 427769f..dabe690 100644
--- a/maintenance/updateExtensionJsonSchema.php
+++ b/maintenance/updateExtensionJsonSchema.php
@@ -14,12 +14,12 @@
        public function execute() {
                $filename = $this->getArg( 0 );
                if ( !is_readable( $filename ) ) {
-                       $this->error( "Error: Unable to read $filename", 1 );
+                       $this->die( "Error: Unable to read $filename" );
                }
 
                $json = FormatJson::decode( file_get_contents( $filename ), 
true );
                if ( $json === null ) {
-                       $this->error( "Error: Invalid JSON", 1 );
+                       $this->die( "Error: Invalid JSON" );
                }
 
                if ( !isset( $json['manifest_version'] ) ) {
diff --git a/maintenance/updateRestrictions.php 
b/maintenance/updateRestrictions.php
index 334ed27..65166a6 100644
--- a/maintenance/updateRestrictions.php
+++ b/maintenance/updateRestrictions.php
@@ -43,12 +43,12 @@
                $db = $this->getDB( DB_MASTER );
                $batchSize = $this->getBatchSize();
                if ( !$db->tableExists( 'page_restrictions' ) ) {
-                       $this->error( "page_restrictions table does not exist", 
true );
+                       $this->die( "page_restrictions table does not exist" );
                }
 
                $start = $db->selectField( 'page', 'MIN(page_id)', false, 
__METHOD__ );
                if ( !$start ) {
-                       $this->error( "Nothing to do.", true );
+                       $this->die( "Nothing to do." );
                }
                $end = $db->selectField( 'page', 'MAX(page_id)', false, 
__METHOD__ );
 
diff --git a/maintenance/updateSpecialPages.php 
b/maintenance/updateSpecialPages.php
index e2c0c61..8d0dd44 100644
--- a/maintenance/updateSpecialPages.php
+++ b/maintenance/updateSpecialPages.php
@@ -72,7 +72,7 @@
                                $queryPage = $specialObj;
                        } else {
                                $class = get_class( $specialObj );
-                               $this->error( "$class is not an instance of 
QueryPage.\n", 1 );
+                               $this->die( "$class is not an instance of 
QueryPage.\n" );
                                die;
                        }
 
diff --git a/maintenance/userOptions.php b/maintenance/userOptions.php
index 7cf16b6..bf34386 100644
--- a/maintenance/userOptions.php
+++ b/maintenance/userOptions.php
@@ -102,7 +102,7 @@
                        // Get the options and update stats
                        if ( $option ) {
                                if ( !array_key_exists( $option, 
$defaultOptions ) ) {
-                                       $this->error( "Invalid user option. Use 
--list to see valid choices\n", 1 );
+                                       $this->die( "Invalid user option. Use 
--list to see valid choices\n" );
                                }
 
                                $userValue = $user->getOption( $option );
diff --git a/maintenance/validateRegistrationFile.php 
b/maintenance/validateRegistrationFile.php
index aa1f668..bf54296 100644
--- a/maintenance/validateRegistrationFile.php
+++ b/maintenance/validateRegistrationFile.php
@@ -9,7 +9,7 @@
        }
        public function execute() {
                $validator = new ExtensionJsonValidator( function ( $msg ) {
-                       $this->error( $msg, 1 );
+                       $this->die( $msg );
                } );
                $validator->checkDependencies();
                $path = $this->getArg( 0 );
@@ -17,7 +17,7 @@
                        $validator->validate( $path );
                        $this->output( "$path validates against the schema!\n" 
);
                } catch ( ExtensionJsonValidationError $e ) {
-                       $this->error( $e->getMessage(), 1 );
+                       $this->die( $e->getMessage() );
                }
        }
 }
diff --git a/maintenance/view.php b/maintenance/view.php
index af7eb2d..48269ce 100644
--- a/maintenance/view.php
+++ b/maintenance/view.php
@@ -38,17 +38,17 @@
        public function execute() {
                $title = Title::newFromText( $this->getArg() );
                if ( !$title ) {
-                       $this->error( "Invalid title", true );
+                       $this->die( "Invalid title" );
                }
 
                $page = WikiPage::factory( $title );
 
                $content = $page->getContent( Revision::RAW );
                if ( !$content ) {
-                       $this->error( "Page has no content", true );
+                       $this->die( "Page has no content" );
                }
                if ( !$content instanceof TextContent ) {
-                       $this->error( "Non-text content models not supported", 
true );
+                       $this->die( "Non-text content models not supported" );
                }
 
                $this->output( $content->getNativeData() );
diff --git a/maintenance/wrapOldPasswords.php b/maintenance/wrapOldPasswords.php
index 6a601ad..49af668 100644
--- a/maintenance/wrapOldPasswords.php
+++ b/maintenance/wrapOldPasswords.php
@@ -43,6 +43,12 @@
        }
 
        public function execute() {
+               global $wgAuth;
+
+               if ( !$wgAuth->allowSetLocalPassword() ) {
+                       $this->die( '$wgAuth does not allow local passwords. 
Aborting.' );
+               }
+
                $passwordFactory = new PasswordFactory();
                $passwordFactory->init( RequestContext::getMain()->getConfig() 
);
 
@@ -51,12 +57,12 @@
 
                // Check that type exists and is a layered type
                if ( !isset( $typeInfo[$layeredType] ) ) {
-                       $this->error( 'Undefined password type', true );
+                       $this->die( 'Undefined password type' );
                }
 
                $passObj = $passwordFactory->newFromType( $layeredType );
                if ( !$passObj instanceof LayeredParameterizedPassword ) {
-                       $this->error( 'Layered parameterized password type must 
be used.', true );
+                       $this->die( 'Layered parameterized password type must 
be used.' );
                }
 
                // Extract the first layer type

-- 
To view, visit https://gerrit.wikimedia.org/r/392363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to