From: Brion Vibber Date: Sat, 14 Jan 2006 02:49:43 +0000 (+0000) Subject: * Added wfDie() wrapper, and some manual die(-1), to force the return code X-Git-Tag: 1.6.0~562 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=266d41f165fe23e85f70f90891f951b0b0bcda7a;p=lhc%2Fweb%2Fwiklou.git * 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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b9814d8403..d869cc1b52 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/img_auth.php b/img_auth.php index 864b0560cd..fb58ba2823 100644 --- a/img_auth.php +++ b/img_auth.php @@ -11,7 +11,8 @@ define( 'MEDIAWIKI', true ); if ( isset( $_REQUEST['GLOBALS'] ) ) { - die( '$GLOBALS overwrite vulnerability'); + echo '$GLOBALS overwrite vulnerability'; + die( -1 ); } require_once( 'includes/Defines.php' ); diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index b9651fac30..8aa8201fb0 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -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; } diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index d79a463fb2..55bd610f60 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -7,7 +7,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); global $wgCategoryMagicGallery; if( $wgCategoryMagicGallery ) diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index f9c4aa3677..b1e48dfa15 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -21,7 +21,7 @@ Example use : */ -if( !defined( 'MEDIAWIKI' ) ) die(); +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); class Categoryfinder { diff --git a/includes/Database.php b/includes/Database.php index 3d2c0fa617..dab31183a0 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -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(); diff --git a/includes/DatabaseOracle.php b/includes/DatabaseOracle.php index 8aec858547..c984240a1f 100644 --- a/includes/DatabaseOracle.php +++ b/includes/DatabaseOracle.php @@ -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; diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 9f3fb50477..d984b2e73c 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -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; diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d6cc7fef71..8c232d6a40 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 ); } /** diff --git a/includes/Exif.php b/includes/Exif.php index 77de1017c0..9816916313 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -1,5 +1,5 @@ namespaces[$ns] = true; } else { - die( "Unrecognized namespace key '$key'\n" ); + wfDie( "Unrecognized namespace key '$key'\n" ); } } } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1e850e777f..3e9783bbe1 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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; } + ?> diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 268d224165..eb4b7eb5c0 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -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" ); } } diff --git a/includes/Hooks.php b/includes/Hooks.php index 94f63c4dbc..64857736fb 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -1,6 +1,6 @@ . diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index a65b40d9e9..1a3a7867c4 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -1,6 +1,6 @@ > 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 ); } /** diff --git a/includes/proxy_check.php b/includes/proxy_check.php index 583e8fdb00..486da56b8e 100644 --- a/includes/proxy_check.php +++ b/includes/proxy_check.php @@ -5,7 +5,7 @@ */ if( php_sapi_name() != 'cli' ) { - die(''); + die( -1 ); } /** diff --git a/includes/templates/Confirmemail.php b/includes/templates/Confirmemail.php index ec1dc1fb1d..07b2a64e8e 100644 --- a/includes/templates/Confirmemail.php +++ b/includes/templates/Confirmemail.php @@ -3,7 +3,7 @@ * @package MediaWiki * @subpackage Templates */ -if( !defined( 'MEDIAWIKI' ) ) die(); +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); /** */ require_once( 'includes/SkinTemplate.php' ); diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index eba92da012..f8a12c037c 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -3,7 +3,7 @@ * @package MediaWiki * @subpackage Templates */ -if( !defined( 'MEDIAWIKI' ) ) die(); +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); /** */ require_once( 'includes/SkinTemplate.php' ); diff --git a/install-utils.inc b/install-utils.inc index 2197fe6ab2..cacb8e590c 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -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')) { diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 515a298e34..7484af74dc 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -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"); } /** diff --git a/maintenance/InitialiseMessages.inc b/maintenance/InitialiseMessages.inc index e75e3500ad..dc89a7916e 100755 --- a/maintenance/InitialiseMessages.inc +++ b/maintenance/InitialiseMessages.inc @@ -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; diff --git a/maintenance/addwiki.php b/maintenance/addwiki.php index 07913907fb..3a559c1586 100644 --- a/maintenance/addwiki.php +++ b/maintenance/addwiki.php @@ -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 \n" ); + wfDie( "Usage: php addwiki.php \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 ); diff --git a/maintenance/backup.inc b/maintenance/backup.inc index a8705da2e0..0e5d89d246 100644 --- a/maintenance/backup.inc +++ b/maintenance/backup.inc @@ -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 ); diff --git a/maintenance/benchmarkPurge.php b/maintenance/benchmarkPurge.php index 45552c1b3b..69127681dc 100644 --- a/maintenance/benchmarkPurge.php +++ b/maintenance/benchmarkPurge.php @@ -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"; diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index 9bb0bab2da..bed5789fd5 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -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" . diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index 7c0d7dd83c..b64917ed26 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -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(); diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index 1c9d1afe9c..1fecc0a4da 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -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 { diff --git a/maintenance/diffLanguage.php b/maintenance/diffLanguage.php index 2bc35d4fd5..7d5c64f5c3 100644 --- a/maintenance/diffLanguage.php +++ b/maintenance/diffLanguage.php @@ -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 */ diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index 09dc148f56..a78975b9b6 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -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" . diff --git a/maintenance/importDump.php b/maintenance/importDump.php index f4e8d3c877..a5a3c1085f 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -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(); diff --git a/maintenance/importUseModWiki.php b/maintenance/importUseModWiki.php index 778a2ef7f1..15f5e4442e 100644 --- a/maintenance/importUseModWiki.php +++ b/maintenance/importUseModWiki.php @@ -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 ) ); diff --git a/maintenance/lang2po.php b/maintenance/lang2po.php index 62ec8d4a75..af6bceea4c 100644 --- a/maintenance/lang2po.php +++ b/maintenance/lang2po.php @@ -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; } diff --git a/maintenance/langmemusage.php b/maintenance/langmemusage.php index b9c26cabe0..d45de0e4e6 100644 --- a/maintenance/langmemusage.php +++ b/maintenance/langmemusage.php @@ -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(); diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php index 3b36bad9af..135f7ed4dd 100755 --- a/maintenance/mwdocgen.php +++ b/maintenance/mwdocgen.php @@ -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 */ diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index b1d2bb1433..fef88e0732 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -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); diff --git a/maintenance/parserTestsParserHook.php b/maintenance/parserTestsParserHook.php index be8e9691bd..28ad8057a1 100644 --- a/maintenance/parserTestsParserHook.php +++ b/maintenance/parserTestsParserHook.php @@ -1,6 +1,6 @@ disable(); diff --git a/profileinfo.php b/profileinfo.php index bdc235bdc3..c7305b3515 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -49,19 +49,21 @@ $wgDBadminuser = $wgDBadminpassword = $wgDBserver = $wgDBname = $wgEnableProfile define("MEDIAWIKI", 1); if ( isset( $_REQUEST['GLOBALS'] ) ) { print $GLOBALS; - die( '$GLOBALS overwrite vulnerability'); + echo '$GLOBALS overwrite vulnerability'; + 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']; diff --git a/redirect.php b/redirect.php index 7c7aa3b165..c0e8746ef6 100644 --- a/redirect.php +++ b/redirect.php @@ -4,7 +4,8 @@ unset( $IP ); $wgCommandLineMode = false; define( 'MEDIAWIKI', true ); if ( isset( $_REQUEST['GLOBALS'] ) ) { - die( '$GLOBALS overwrite vulnerability'); + echo '$GLOBALS overwrite vulnerability'; + die( -1 ); } require_once( './includes/Defines.php' ); diff --git a/skins/Chick.php b/skins/Chick.php index e56a17b70b..d5a4a080e5 100644 --- a/skins/Chick.php +++ b/skins/Chick.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('MonoBook.php'); diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index ebe3fb4c12..969526d15c 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** * @todo document diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 0317d18d52..54f8cfa68b 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -11,7 +11,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('includes/SkinTemplate.php'); diff --git a/skins/MySkin.php b/skins/MySkin.php index 232a0cfaf5..cb24fdc4d8 100644 --- a/skins/MySkin.php +++ b/skins/MySkin.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('MonoBook.php'); diff --git a/skins/Nostalgia.php b/skins/Nostalgia.php index 0e2d269cd8..54bd1a75d4 100644 --- a/skins/Nostalgia.php +++ b/skins/Nostalgia.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** * @todo document diff --git a/skins/Simple.php b/skins/Simple.php index 53a98e4bab..d1ebd7d954 100644 --- a/skins/Simple.php +++ b/skins/Simple.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('MonoBook.php'); diff --git a/skins/Standard.php b/skins/Standard.php index 1c3447d228..067496fa88 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** * @todo document diff --git a/skins/disabled/Amethyst.php b/skins/disabled/Amethyst.php index ed1e1d76a1..c97d679839 100644 --- a/skins/disabled/Amethyst.php +++ b/skins/disabled/Amethyst.php @@ -10,7 +10,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** Skin reuse monobook template */ require_once('MonoBook.php'); diff --git a/skins/disabled/Chick.php b/skins/disabled/Chick.php index 75f8285dae..8f3a42ee06 100644 --- a/skins/disabled/Chick.php +++ b/skins/disabled/Chick.php @@ -8,7 +8,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('includes/SkinPHPTal.php'); diff --git a/skins/disabled/HTMLDump.php b/skins/disabled/HTMLDump.php index 5451cd34dd..792f4a65ea 100644 --- a/skins/disabled/HTMLDump.php +++ b/skins/disabled/HTMLDump.php @@ -5,7 +5,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once( 'includes/SkinTemplate.php' ); diff --git a/skins/disabled/MonoBookTal.php b/skins/disabled/MonoBookTal.php index 876150ce22..8a666c6119 100644 --- a/skins/disabled/MonoBookTal.php +++ b/skins/disabled/MonoBookTal.php @@ -15,7 +15,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ require_once('includes/SkinPHPTal.php'); diff --git a/skins/disabled/WikimediaWiki.php b/skins/disabled/WikimediaWiki.php index 87564df04f..96ae1fac43 100644 --- a/skins/disabled/WikimediaWiki.php +++ b/skins/disabled/WikimediaWiki.php @@ -7,7 +7,7 @@ */ if( !defined( 'MEDIAWIKI' ) ) - die(); + die( -1 ); /** */ diff --git a/tests/RunTests.php b/tests/RunTests.php index 81ed74ab93..020dba407e 100644 --- a/tests/RunTests.php +++ b/tests/RunTests.php @@ -1,7 +1,8 @@ query($create_tmp); } diff --git a/thumb.php b/thumb.php index f4765d6c01..07a6abc21a 100644 --- a/thumb.php +++ b/thumb.php @@ -8,7 +8,8 @@ define( 'MEDIAWIKI', true ); unset( $IP ); if ( isset( $_REQUEST['GLOBALS'] ) ) { - die( '$GLOBALS overwrite vulnerability'); + echo '$GLOBALS overwrite vulnerability'; + die( -1 ); } $wgNoOutputBuffer = true; diff --git a/trackback.php b/trackback.php index 64ca383f53..d8170c3d7c 100644 --- a/trackback.php +++ b/trackback.php @@ -8,7 +8,8 @@ unset($IP); define('MEDIAWIKI', true); if ( isset( $_REQUEST['GLOBALS'] ) ) { - die( '$GLOBALS overwrite vulnerability'); + echo '$GLOBALS overwrite vulnerability'; + die( -1 ); } require_once('./includes/Defines.php');