* Added wfDie() wrapper, and some manual die(-1), to force the return code
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 14 Jan 2006 02:49:43 +0000 (02:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 14 Jan 2006 02:49:43 +0000 (02:49 +0000)
  to the shell to return nonzero when we crap out with an error.

72 files changed:
RELEASE-NOTES
img_auth.php
includes/BagOStuff.php
includes/CategoryPage.php
includes/Categoryfinder.php
includes/Database.php
includes/DatabaseOracle.php
includes/DatabasePostgreSQL.php
includes/DefaultSettings.php
includes/Exif.php
includes/Export.php
includes/GlobalFunctions.php
includes/HistoryBlob.php
includes/Hooks.php
includes/ImageGallery.php
includes/ImagePage.php
includes/Namespace.php
includes/ObjectCache.php
includes/OutputPage.php
includes/PersistentObject.php
includes/ProxyTools.php
includes/Setup.php
includes/Skin.php
includes/SkinPHPTal.php
includes/SkinTemplate.php
includes/SpecialPreferences.php
includes/compatability/ctype.php
includes/normal/UtfNormalUtil.php
includes/proxy_check.php
includes/templates/Confirmemail.php
includes/templates/Userlogin.php
install-utils.inc
languages/LanguageConverter.php
maintenance/InitialiseMessages.inc
maintenance/addwiki.php
maintenance/backup.inc
maintenance/benchmarkPurge.php
maintenance/changePassword.php
maintenance/cleanupTitles.php
maintenance/commandLine.inc
maintenance/diffLanguage.php
maintenance/generateSitemap.php
maintenance/importDump.php
maintenance/importUseModWiki.php
maintenance/lang2po.php
maintenance/langmemusage.php
maintenance/mwdocgen.php
maintenance/parserTests.inc
maintenance/parserTestsParserHook.php
maintenance/parserTestsParserTime.php
maintenance/rebuildInterwiki.inc
maintenance/removeUnusedAccounts.php
maintenance/storage/compressOld.php
maintenance/transstat.php
maintenance/updateSpecialPages.php
profileinfo.php
redirect.php
skins/Chick.php
skins/CologneBlue.php
skins/MonoBook.php
skins/MySkin.php
skins/Nostalgia.php
skins/Simple.php
skins/Standard.php
skins/disabled/Amethyst.php
skins/disabled/Chick.php
skins/disabled/HTMLDump.php
skins/disabled/MonoBookTal.php
skins/disabled/WikimediaWiki.php
tests/RunTests.php
thumb.php
trackback.php

index b9814d8..d869cc1 100644 (file)
@@ -484,6 +484,8 @@ fully support the editing toolbar, but was found to be too confusing.
 * Add wfClone() wrapper since we're still using PHP 4 on some servers.
 * Fixed installer bugs 921 and 3914 (issues with using root and so forth)
 * Remove obsolete killthread.php
+* Added wfDie() wrapper, and some manual die(-1), to force the return code
+  to the shell to return nonzero when we crap out with an error.
 
 
 === Caveats ===
index 864b056..fb58ba2 100644 (file)
@@ -11,7 +11,8 @@
 define( 'MEDIAWIKI', true );
 
 if ( isset( $_REQUEST['GLOBALS'] ) ) {
-       die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
 }
 
 require_once( 'includes/Defines.php' );
index b9651fa..8aa8201 100644 (file)
@@ -293,14 +293,14 @@ class SqlBagOStuff extends BagOStuff {
                return $str;
        }
        function _doinsert($table, $vals) {
-               die( 'abstract function SqlBagOStuff::_doinsert() must be defined' );
+               wfDie( 'abstract function SqlBagOStuff::_doinsert() must be defined' );
        }
        function _doquery($sql) {
-               die( 'abstract function SqlBagOStuff::_doquery() must be defined' );
+               wfDie( 'abstract function SqlBagOStuff::_doquery() must be defined' );
        }
 
        function _fetchrow($res) {
-               die( 'abstract function SqlBagOStuff::_fetchrow() must be defined' );
+               wfDie( 'abstract function SqlBagOStuff::_fetchrow() must be defined' );
        }
 
        function _freeresult($result) {
@@ -314,11 +314,11 @@ class SqlBagOStuff extends BagOStuff {
        }
 
        function _maxdatetime() {
-               die( 'abstract function SqlBagOStuff::_maxdatetime() must be defined' );
+               wfDie( 'abstract function SqlBagOStuff::_maxdatetime() must be defined' );
        }
 
        function _fromunixtime() {
-               die( 'abstract function SqlBagOStuff::_fromunixtime() must be defined' );
+               wfDie( 'abstract function SqlBagOStuff::_fromunixtime() must be defined' );
        }
 
        function garbageCollect() {
@@ -427,7 +427,7 @@ class MediaWikiBagOStuff extends SqlBagOStuff {
                        /* This is actually a hack, we should be able
                           to use Language classes here... or not */
                        if (!$dbw)
-                               die("Could not connect to database");
+                               wfDie("Could not connect to database");
                        $this->table = $dbw->tableName( $this->table );
                        $this->tableInitialised = true;
                }
index d79a463..55bd610 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 global $wgCategoryMagicGallery;
 if( $wgCategoryMagicGallery )
index f9c4aa3..b1e48df 100644 (file)
@@ -21,7 +21,7 @@ Example use :
 */
 
 
-if( !defined( 'MEDIAWIKI' ) ) die();
+if( !defined( 'MEDIAWIKI' ) ) die( -1 );
 
 class Categoryfinder {
 
index 3d2c0fa..dab3118 100644 (file)
@@ -255,7 +255,7 @@ class Database {
 
                # Otherwise we get a suppressed fatal error, which is very hard to track down
                if ( !function_exists( 'mysql_connect' ) ) {
-                       die( "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n" );
+                       wfDie( "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n" );
                }
 
                $this->close();
index 8aec858..c984240 100644 (file)
@@ -52,7 +52,7 @@ class DatabaseOracle extends Database {
         */
        function open( $server, $user, $password, $dbName ) {
                if ( !function_exists( 'oci_connect' ) ) {
-                       die( "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" );
+                       wfDie( "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" );
                }
                $this->close();
                $this->mServer = $server;
index 9f3fb50..d984b2e 100644 (file)
@@ -45,7 +45,7 @@ class DatabasePgsql extends Database {
        function open( $server, $user, $password, $dbName ) {
                # Test for PostgreSQL support, to avoid suppressed fatal error
                if ( !function_exists( 'pg_connect' ) ) {
-                       die( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" );
+                       wfDie( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" );
                }
 
                global $wgDBschema;
index d6cc7fe..8c232d6 100644 (file)
@@ -20,7 +20,8 @@
 
 # This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
 if( !defined( 'MEDIAWIKI' ) ) {
-       die( "This file is part of MediaWiki and is not a valid entry point\n" );
+       echo "This file is part of MediaWiki and is not a valid entry point\n";
+       die( -1 );
 }
 
 /**
index 77de101..9816916 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-if ( !defined( 'MEDIAWIKI' ) ) die();
+if ( !defined( 'MEDIAWIKI' ) ) die( -1 );
 /**
  * @package MediaWiki
  * @subpackage Metadata
index 71a771b..f49b685 100644 (file)
@@ -588,7 +588,7 @@ class DumpNamespaceFilter extends DumpFilter {
                                $ns = intval( $key );
                                $this->namespaces[$ns] = true;
                        } else {
-                               die( "Unrecognized namespace key '$key'\n" );
+                               wfDie( "Unrecognized namespace key '$key'\n" );
                        }
                }
        }
index 1e850e7..3e9783b 100644 (file)
@@ -581,6 +581,16 @@ function wfErrorExit() {
        wfAbruptExit( true );
 }
 
+/**
+ * Print a simple message and die, returning nonzero to the shell if any.
+ * Plain die() fails to return nonzero to the shell if you pass a string.
+ * @param string $msg
+ */
+function wfDie( $msg='' ) {
+       echo $msg;
+       die( -1 );
+}
+
 /**
  * Die with a backtrace
  * This is meant as a debugging aid to track down where bad data comes from.
@@ -1763,4 +1773,5 @@ function wfRegexReplacement( $string ) {
        return $string;
 }
 
+
 ?>
index 268d224..eb4b7eb 100644 (file)
@@ -59,7 +59,7 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob
 
        function ConcatenatedGzipHistoryBlob() {
                if ( !function_exists( 'gzdeflate' ) ) {
-                       die( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" );
+                       wfDie( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" );
                }
        }
 
index 94f63c4..6485773 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * Hooks.php -- a tool for running hook functions
  * Copyright 2004, 2005 Evan Prodromou <evan@wikitravel.org>.
index a65b40d..1a3a786 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  * @package MediaWiki
index cb0c867..5f681d6 100644 (file)
@@ -7,7 +7,7 @@
  *
  */
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 require_once( 'Image.php' );
 
index bde2334..1d85ae3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * Provide things related to namespaces
  * @package MediaWiki
index f01171e..4fa2aea 100644 (file)
@@ -5,7 +5,10 @@
  */
 
 /** */
-if (!defined('MEDIAWIKI')) die( "Not a valid entry point\n");
+if (!defined('MEDIAWIKI')) {
+       echo "Not a valid entry point\n";
+       die( -1 );
+}
 
 
 /**
index f356e23..f04bc64 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * @package MediaWiki
  */
index 5c53acd..04c805d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * Sometimes one wants to make an extension that defines a class that one wants
  * to backreference somewhere else in the code, doing something like:
index 699cf19..6201f32 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * Functions for dealing with proxies
  * @package MediaWiki
index c085799..705a719 100644 (file)
@@ -18,7 +18,8 @@ if( defined( 'MEDIAWIKI' ) ) {
 
 // Check to see if we are at the file scope
 if ( !isset( $wgVersion ) ) {
-       die( "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n" );
+       echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
+       die( -1 );
 }
 
 if( !isset( $wgProfiling ) )
index eb73b38..0dd3077 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  *
index 156e455..286733e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
index 34562ec..37acb78 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
index 23e476e..d8bd95c 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  * Entry point that create the "Preferences" object
index a68edf9..2724d8f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * PHP <4.2.0 doesn't build ctype_ functions by default and Gentoo doesn't
  * build it by default, and that probably applies for some other distributions
index 185271c..552a9f8 100644 (file)
@@ -47,7 +47,8 @@ function codepointToUtf8( $codepoint ) {
                                                                         chr($codepoint >>      6 & 0x3f | 0x80) .
                                                                         chr($codepoint           & 0x3f | 0x80);
 
-       die("Asked for code outside of range ($codepoint)\n");
+       echo "Asked for code outside of range ($codepoint)\n";
+       die( -1 );
 }
 
 /**
index 583e8fd..486da56 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 if( php_sapi_name() != 'cli' ) {
-       die('');
+       die( -1 );
 }
 
 /**
index ec1dc1f..07b2a64 100644 (file)
@@ -3,7 +3,7 @@
  * @package MediaWiki
  * @subpackage Templates
  */
-if( !defined( 'MEDIAWIKI' ) ) die();
+if( !defined( 'MEDIAWIKI' ) ) die( -1 );
 
 /** */
 require_once( 'includes/SkinTemplate.php' );
index eba92da..f8a12c0 100644 (file)
@@ -3,7 +3,7 @@
  * @package MediaWiki
  * @subpackage Templates
  */
-if( !defined( 'MEDIAWIKI' ) ) die();
+if( !defined( 'MEDIAWIKI' ) ) die( -1 );
 
 /** */
 require_once( 'includes/SkinTemplate.php' );
index 2197fe6..cacb8e5 100644 (file)
@@ -7,10 +7,12 @@ function install_version_checks() {
 
        if( !function_exists( 'version_compare' ) ) {
                # version_compare was introduced in 4.1.0
-               die( "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is required. ABORTING.\n" );
+               echo "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is required. ABORTING.\n";
+               die( -1 );
        }
        if( version_compare( phpversion(), '4.3.2' ) < 0 ) {
-               die( "PHP 4.3.2 or higher is required. ABORTING.\n" );
+               echo "PHP 4.3.2 or higher is required. ABORTING.\n";
+               die( -1 );
        }
 
        if (!extension_loaded('mysql')) {
index 515a298..7484af7 100644 (file)
@@ -434,7 +434,7 @@ class LanguageConverter {
      */
        function loadDefaultTables() {
                $name = get_class($this);
-               die("Must implement loadDefaultTables() method in class $name");
+               wfDie("Must implement loadDefaultTables() method in class $name");
        }
 
        /**
index e75e350..dc89a79 100755 (executable)
@@ -39,7 +39,7 @@ function initialiseMessages( $overwrite = false, $messageArray = false ) {
        foreach ($variants as $v) {
                $langclass = 'Language'. str_replace( '-', '_', ucfirst( $v ) );
                if( !class_exists($langclass) ) {
-                       die ("class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?");
+                       wfDie( "class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?" );
                }
                $lang = new $langclass;
 
index 0791390..3a559c1 100644 (file)
@@ -6,7 +6,7 @@ require_once( "commandLine.inc" );
 require_once( "rebuildInterwiki.inc" );
 require_once( "languages/Names.php" );
 if ( count( $args ) != 3 ) {
-       die( "Usage: php addwiki.php <language> <site> <dbname>\n" );
+       wfDie( "Usage: php addwiki.php <language> <site> <dbname>\n" );
 }
 
 addWiki( $args[0], $args[1], $args[2] );
@@ -197,7 +197,7 @@ See the [http://www.wikipedia.org Wikipedia portal] for other language Wikipedia
        $tempname = tempnam( '/tmp', 'addwiki' );
        $file = fopen( $tempname, 'w' );
        if ( !$file ) {
-               die( "Error, unable to open temporary file $tempname\n" );
+               wfDie( "Error, unable to open temporary file $tempname\n" );
        }
        fwrite( $file, $sql );
        fclose( $file );
index a8705da..0e5d89d 100644 (file)
@@ -103,7 +103,7 @@ class BackupDumper {
                                                $sinks[] = $sink;
                                        }
                                        if( !isset( $this->outputTypes[$val] ) ) {
-                                               die( "Unrecognized output sink type '$val'\n" );
+                                               wfDie( "Unrecognized output sink type '$val'\n" );
                                        }
                                        $type = $this->outputTypes[$val];
                                        $sink = new $type( $param );
@@ -114,7 +114,7 @@ class BackupDumper {
                                                $sink = new DumpOutput();
                                        }
                                        if( !isset( $this->filterTypes[$val] ) ) {
-                                               die( "Unrecognized filter type '$val'\n" );
+                                               wfDie( "Unrecognized filter type '$val'\n" );
                                        }
                                        $type = $this->filterTypes[$val];
                                        $filter = new $type( $sink, $param );
index 45552c1..6912768 100644 (file)
@@ -47,7 +47,7 @@ function randomTitle() {
 }
 
 if( !$wgUseSquid ) {
-       die( "Squid purge benchmark doesn't do much without squid support on.\n" );
+       wfDie( "Squid purge benchmark doesn't do much without squid support on.\n" );
 } else {
        printf( "There are %d defined squid servers:\n", count( $wgSquidServers ) );
        #echo implode( "\n", $wgSquidServers ) . "\n";
index 9bb0bab..bed5789 100644 (file)
@@ -40,7 +40,7 @@ $optionsWithArgs = array( 'user', 'password' );
 require_once 'commandLine.inc';
 
 if( in_array( '--help', $argv ) )
-       die(
+       wfDie(
                "Usage: php changePassword.php [--user=user --password=password | --help]\n" .
                "\toptions:\n" .
                "\t\t--help\tshow this message\n" .
index 7c0d7dd..b64917e 100644 (file)
@@ -177,7 +177,7 @@ class TitleCleanup extends FiveUpgrade {
                        $title = $verified;
                }
                if( is_null( $title ) ) {
-                       die( "Something awry; empty title.\n" );
+                       wfDie( "Something awry; empty title.\n" );
                }
                $ns = $title->getNamespace();
                $dest = $title->getDbKey();
index 1c9d1af..1fecc0a 100644 (file)
@@ -42,7 +42,8 @@ for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
                if ( in_array( $option, $optionsWithArgs ) ) {
                        $param = next( $argv );
                        if ( $param === false ) {
-                               die( "$arg needs an value after it\n" );
+                               echo "$arg needs an value after it\n";
+                               die( -1 );
                        }
                        $options[$option] = $param;
                } else {
@@ -62,7 +63,8 @@ for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) {
                        if ( in_array( $option, $optionsWithArgs ) ) {
                                $param = next( $argv );
                                if ( $param === false ) {
-                                       die( "$arg needs an value after it\n" );
+                                       echo "$arg needs an value after it\n";
+                                       die( -1 );
                                }
                                $options[$option] = $param;
                        } else {
index 2bc35d4..7d5c64f 100644 (file)
@@ -43,7 +43,7 @@
 require_once( 'parserTests.inc' );
 require_once( 'commandLine.inc' );
 
-if( isset($options['help']) ) { usage(); die(); }
+if( isset($options['help']) ) { usage(); wfDie(); }
 
 $wgLanguageCode = ucfirstlcrest($wgLanguageCode);
 /** Language messages we will use as reference. By default 'en' */
@@ -85,7 +85,7 @@ function getMediawikiMessages($languageCode = 'En') {
                        print "Including $langFile\n";
                        global $wgNamespaceNamesEn;
                        include($langFile);
-               } else die("ERROR: The file $langFile does not exist !\n");
+               } else wfDie("ERROR: The file $langFile does not exist !\n");
        }
        return $$foo;
 }
@@ -124,7 +124,7 @@ if ( isset($args[0]) ) {
        $testLanguage = $lang;
 } else {
        usage();
-       die();
+       wfDie();
 }
 
 /** parsertest is used to do differences */
index 09dc148..a78975b 100644 (file)
@@ -441,7 +441,7 @@ class GenerateSitemap {
 }
 
 if ( in_array( '--help', $argv ) )
-       die(
+       wfDie(
                "Usage: php generateSitemap.php [host] [options]\n" .
                "\thost = hostname\n" .
                "\toptions:\n" .
index f4e8d3c..a5a3c10 100644 (file)
@@ -112,7 +112,7 @@ class BackupReader {
 }
 
 if( wfReadOnly() ) {
-       die( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" );
+       wfDie( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" );
 }
 
 $reader = new BackupReader();
index 778a2ef..15f5e44 100644 (file)
@@ -27,7 +27,8 @@
  */
 
 if( php_sapi_name() != 'cli' ) {
-       die( "Please customize the settings and run me from the command line." );
+       echo "Please customize the settings and run me from the command line.";
+       die( -1 );
 }
 
 /** Set these correctly! */
@@ -124,7 +125,8 @@ function fetchPage( $title )
 
        $fname = $wgRootDirectory . "/page/" . useModFilename( $title ) . ".db";
        if( !file_exists( $fname ) ) {
-               die( "Couldn't open file '$fname' for page '$title'.\n" );
+               echo "Couldn't open file '$fname' for page '$title'.\n";
+               die( -1 );
        }
 
        $page = splitHash( $FS1, file_get_contents( $fname ) );
index 62ec8d4..af6bcee 100644 (file)
@@ -22,7 +22,7 @@ define('MSGMERGE_OPTIONS', ' -v ');
 define('LOCALE_OUTPUT_DIR', $IP.'/locale');
 
 
-if( isset($options['help']) ) { usage(); die(); }
+if( isset($options['help']) ) { usage(); wfDie(); }
 // default output is WikiText
 if( !isset($options['lang']) ) { $options['lang'] = ALL_LANGUAGES; }
 
index b9c26ca..d45de0e 100644 (file)
@@ -11,7 +11,7 @@ require_once('languages.inc');
 $langtool = new languages();
 
 if ( ! function_exists( 'memory_get_usage' ) )
-       die( "You must compile PHP with --enable-memory-limit\n" );
+       wfDie( "You must compile PHP with --enable-memory-limit\n" );
 
 $memlast = $memstart = memory_get_usage();
 
index 3b36bad..135f7ed 100755 (executable)
@@ -23,7 +23,8 @@
 #
 
 if( php_sapi_name() != 'cli' ) {
-       die( "Run me from the command line." );
+       echo "Run me from the command line.";
+       die( -1 );
 }
 
 /** Phpdoc script with full path */
index b1d2bb1..fef88e0 100644 (file)
@@ -121,7 +121,7 @@ class ParserTest {
        function runTestsFromFile( $filename ) {
                $infile = fopen( $filename, 'rt' );
                if( !$infile ) {
-                       die( "Couldn't open parserTests.txt\n" );
+                       wfDie( "Couldn't open parserTests.txt\n" );
                }
 
                $data = array();
@@ -135,10 +135,10 @@ class ParserTest {
                                $section = strtolower( $matches[1] );
                                if( $section == 'endarticle') {
                                        if( !isset( $data['text'] ) ) {
-                                               die( "'endarticle' without 'text' at line $n\n" );
+                                               wfDie( "'endarticle' without 'text' at line $n\n" );
                                        }
                                        if( !isset( $data['article'] ) ) {
-                                               die( "'endarticle' without 'article' at line $n\n" );
+                                               wfDie( "'endarticle' without 'article' at line $n\n" );
                                        }
                                        $this->addArticle($this->chomp($data['article']), $this->chomp($data['text']), $n);
                                        $data = array();
@@ -147,13 +147,13 @@ class ParserTest {
                                }
                                if( $section == 'end' ) {
                                        if( !isset( $data['test'] ) ) {
-                                               die( "'end' without 'test' at line $n\n" );
+                                               wfDie( "'end' without 'test' at line $n\n" );
                                        }
                                        if( !isset( $data['input'] ) ) {
-                                               die( "'end' without 'input' at line $n\n" );
+                                               wfDie( "'end' without 'input' at line $n\n" );
                                        }
                                        if( !isset( $data['result'] ) ) {
-                                               die( "'end' without 'result' at line $n\n" );
+                                               wfDie( "'end' without 'result' at line $n\n" );
                                        }
                                        if( !isset( $data['options'] ) ) {
                                                $data['options'] = '';
@@ -181,7 +181,7 @@ class ParserTest {
                                        continue;
                                }
                                if ( isset ($data[$section] ) ) {
-                                       die ( "duplicate section '$section' at line $n\n" );
+                                       wfDie( "duplicate section '$section' at line $n\n" );
                                }
                                $data[$section] = '';
                                continue;
@@ -201,7 +201,7 @@ class ParserTest {
                        print $this->termReset() . "\n";
                        return ($success == $total);
                } else {
-                       die( "No tests found.\n" );
+                       wfDie( "No tests found.\n" );
                }
        }
 
@@ -386,7 +386,7 @@ class ParserTest {
                                                . $wgDBprefix . $tbl .'`', $create);
                                        if ($create === $create_tmp) {
                                                # Couldn't do replacement
-                                               die("could not create temporary table $tbl");
+                                               wfDie("could not create temporary table $tbl");
                                        }
                                        $db->query($create_tmp);
                                }
@@ -638,12 +638,12 @@ class ParserTest {
                $this->setupGlobals();
                $title = Title::newFromText( $name );
                if ( is_null($title) ) {
-                       die( "invalid title at line $line\n" );
+                       wfDie( "invalid title at line $line\n" );
                }
 
                $aid = $title->getArticleID( GAID_FOR_UPDATE );
                if ($aid != 0) {
-                       die( "duplicate article at line $line\n" );
+                       wfDie( "duplicate article at line $line\n" );
                }
 
                $art = new Article($title);
index be8e969..28ad805 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * A basic extension that's used by the parser tests to test whether input and
  * arguments are passed to extensions properly.
index 727c4dc..f1b2267 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 /**
  * A basic extension that's used by the parser tests to test date magic words
  *
index d2c2297..501daea 100644 (file)
@@ -102,7 +102,7 @@ function getRebuildInterwikiSQL() {
        $lines = array_map( 'trim', explode( "\n", trim( $intermap ) ) );
 
        if ( !$lines || count( $lines ) < 2 ) {
-               die( "m:Interwiki_map not found" );
+               wfDie( "m:Interwiki_map not found" );
        }
 
        $iwArray = array();
index 865a2cd..a507de6 100644 (file)
@@ -18,7 +18,7 @@ echo( "Remove Unused Accounts\nThis script will delete all users who have made n
 # Check parameters
 if( @$options['help'] ) {
        echo( "USAGE: removeUnusedAccounts.php [--help|--delete]\n\nThe first (default) account is ignored.\n\n" );
-       die();
+       wfDie();
 } else {
        $delete = @$options['delete'] ? true : false ;
 }
index c0b3d1c..9cee055 100644 (file)
@@ -38,7 +38,7 @@ require_once( "compressOld.inc" );
 if( !function_exists( "gzdeflate" ) ) {
        print "You must enable zlib support in PHP to compress old revisions!\n";
        print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n";
-       die();
+       wfDie();
 }
 
 $defaults = array(
index f4de60e..8bdd7c0 100644 (file)
@@ -15,7 +15,7 @@
 require_once('commandLine.inc');
 require_once('languages.inc');
 
-if( isset($options['help']) ) { usage(); die(); }
+if( isset($options['help']) ) { usage(); wfDie(); }
 // default output is WikiText
 if( !isset($options['output']) ) { $options['output']='wiki'; }
 
@@ -121,7 +121,7 @@ switch ($options['output']) {
        case 'wiki':
                $out = new wikiStatsOutput(); break;
        default:
-               usage(); die();
+               usage(); wfDie();
        break;
 }
 
index 15191b6..71c688f 100644 (file)
@@ -13,7 +13,7 @@ if(@$options['help']) {
        print "  --help      : this help message\n";
        print "  --list      : list special pages names\n";
        print "  --only=page : only update 'page'. Ex: --only=BrokenRedirects\n";
-       die();
+       wfDie();
 }
 
 $wgOut->disable();
index bdc235b..c7305b3 100644 (file)
@@ -49,19 +49,21 @@ $wgDBadminuser = $wgDBadminpassword = $wgDBserver = $wgDBname = $wgEnableProfile
 define("MEDIAWIKI", 1);
 if ( isset( $_REQUEST['GLOBALS'] ) ) {
        print $GLOBALS;
-       die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
 }
 
 require_once("./includes/Defines.php");
 require_once("./LocalSettings.php");
 require_once("./AdminSettings.php");
 
-if (!$wgEnableProfileInfo)
-       die("disabled");
+if (!$wgEnableProfileInfo) {
+       wfDie("disabled");
+}
 
 foreach (array("wgDBadminuser", "wgDBadminpassword", "wgDBserver", "wgDBname") as $var)
        if ($$var === false)
-               die("AdminSettings.php not correct");
+               wfDie("AdminSettings.php not correct");
 
 $expand = array();
 if (isset($_REQUEST['expand']))
@@ -155,13 +157,13 @@ if (isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sorts))
        $sort = $_REQUEST['sort'];
 
 $dbh = mysql_connect($wgDBserver, $wgDBadminuser, $wgDBadminpassword)
-       or die("mysql server failed: " . mysql_error());
-mysql_select_db($wgDBname, $dbh) or die(mysql_error($dbh));
+       or wfDie("mysql server failed: " . mysql_error());
+mysql_select_db($wgDBname, $dbh) or wfDie(mysql_error($dbh));
 $res = mysql_query("
        SELECT pf_count, pf_time, pf_name
        FROM profiling
        ORDER BY pf_name ASC
-", $dbh) or die("query failed: " . mysql_error());
+", $dbh) or wfDie("query failed: " . mysql_error());
 
 if (isset($_REQUEST['filter']))
        $filter = $_REQUEST['filter'];
index 7c7aa3b..c0e8746 100644 (file)
@@ -4,7 +4,8 @@ unset( $IP );
 $wgCommandLineMode = false;
 define( 'MEDIAWIKI', true );
 if ( isset( $_REQUEST['GLOBALS'] ) ) {
-       die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
 }
 
 require_once( './includes/Defines.php' );
index e56a17b..d5a4a08 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('MonoBook.php');
index ebe3fb4..969526d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  * @todo document
index 0317d18..54f8cfa 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('includes/SkinTemplate.php');
index 232a0cf..cb24fdc 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('MonoBook.php');
index 0e2d269..54bd1a7 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  * @todo document
index 53a98e4..d1ebd7d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('MonoBook.php');
index 1c3447d..067496f 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /**
  * @todo document
index ed1e1d7..c97d679 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** Skin reuse monobook template */
 require_once('MonoBook.php');
index 75f8285..8f3a42e 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('includes/SkinPHPTal.php');
index 5451cd3..792f4a6 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once( 'includes/SkinTemplate.php' );
index 876150c..8a666c6 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 require_once('includes/SkinPHPTal.php');
index 87564df..96ae1fa 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 if( !defined( 'MEDIAWIKI' ) )
-       die();
+       die( -1 );
 
 /** */
 
index 81ed74a..020dba4 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
 if( php_sapi_name() != 'cli' ) {
-       die( 'Must be run from the command line.' );
+       echo 'Must be run from the command line.';
+       die( -1 );
 }
 
 error_reporting( E_ALL );
@@ -74,7 +75,7 @@ function &buildTestDatabase( $serverType, $tables ) {
                                        . $wgDBprefix . '\\1`', $create);
                                if ($create === $create_tmp) {
                                        # Couldn't do replacement
-                                       die("could not create temporary table $tbl");
+                                       wfDie( "could not create temporary table $tbl" );
                                }
                                $db->query($create_tmp);
                        }
index f4765d6..07a6abc 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -8,7 +8,8 @@
 define( 'MEDIAWIKI', true );
 unset( $IP );
 if ( isset( $_REQUEST['GLOBALS'] ) ) {
-       die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
 }
 
 $wgNoOutputBuffer = true;
index 64ca383..d8170c3 100644 (file)
@@ -8,7 +8,8 @@
 unset($IP);
 define('MEDIAWIKI', true);
 if ( isset( $_REQUEST['GLOBALS'] ) ) {
-       die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
 }
 
 require_once('./includes/Defines.php');