Index: trunk/phase3/install-utils.inc |
— | — | @@ -7,10 +7,12 @@ |
8 | 8 | |
9 | 9 | if( !function_exists( 'version_compare' ) ) { |
10 | 10 | # version_compare was introduced in 4.1.0 |
11 | | - die( "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is required. ABORTING.\n" ); |
| 11 | + echo "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is required. ABORTING.\n"; |
| 12 | + die( -1 ); |
12 | 13 | } |
13 | 14 | if( version_compare( phpversion(), '4.3.2' ) < 0 ) { |
14 | | - die( "PHP 4.3.2 or higher is required. ABORTING.\n" ); |
| 15 | + echo "PHP 4.3.2 or higher is required. ABORTING.\n"; |
| 16 | + die( -1 ); |
15 | 17 | } |
16 | 18 | |
17 | 19 | if (!extension_loaded('mysql')) { |
Index: trunk/phase3/maintenance/changePassword.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | require_once 'commandLine.inc'; |
42 | 42 | |
43 | 43 | if( in_array( '--help', $argv ) ) |
44 | | - die( |
| 44 | + wfDie( |
45 | 45 | "Usage: php changePassword.php [--user=user --password=password | --help]\n" . |
46 | 46 | "\toptions:\n" . |
47 | 47 | "\t\t--help\tshow this message\n" . |
Index: trunk/phase3/maintenance/removeUnusedAccounts.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | # Check parameters |
20 | 20 | if( @$options['help'] ) { |
21 | 21 | echo( "USAGE: removeUnusedAccounts.php [--help|--delete]\n\nThe first (default) account is ignored.\n\n" ); |
22 | | - die(); |
| 22 | + wfDie(); |
23 | 23 | } else { |
24 | 24 | $delete = @$options['delete'] ? true : false ; |
25 | 25 | } |
Index: trunk/phase3/maintenance/backup.inc |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | $sinks[] = $sink; |
105 | 105 | } |
106 | 106 | if( !isset( $this->outputTypes[$val] ) ) { |
107 | | - die( "Unrecognized output sink type '$val'\n" ); |
| 107 | + wfDie( "Unrecognized output sink type '$val'\n" ); |
108 | 108 | } |
109 | 109 | $type = $this->outputTypes[$val]; |
110 | 110 | $sink = new $type( $param ); |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | $sink = new DumpOutput(); |
116 | 116 | } |
117 | 117 | if( !isset( $this->filterTypes[$val] ) ) { |
118 | | - die( "Unrecognized filter type '$val'\n" ); |
| 118 | + wfDie( "Unrecognized filter type '$val'\n" ); |
119 | 119 | } |
120 | 120 | $type = $this->filterTypes[$val]; |
121 | 121 | $filter = new $type( $sink, $param ); |
Index: trunk/phase3/maintenance/importDump.php |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | } |
114 | 114 | |
115 | 115 | if( wfReadOnly() ) { |
116 | | - die( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" ); |
| 116 | + wfDie( "Wiki is in read-only mode; you'll need to disable it for import to work.\n" ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $reader = new BackupReader(); |
Index: trunk/phase3/maintenance/updateSpecialPages.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | print " --help : this help message\n"; |
15 | 15 | print " --list : list special pages names\n"; |
16 | 16 | print " --only=page : only update 'page'. Ex: --only=BrokenRedirects\n"; |
17 | | - die(); |
| 17 | + wfDie(); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $wgOut->disable(); |
Index: trunk/phase3/maintenance/InitialiseMessages.inc |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | foreach ($variants as $v) { |
41 | 41 | $langclass = 'Language'. str_replace( '-', '_', ucfirst( $v ) ); |
42 | 42 | if( !class_exists($langclass) ) { |
43 | | - die ("class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?"); |
| 43 | + wfDie( "class $langclass not defined. perhaps you need to include the file $langclass.php in $wgContLangClass.php?" ); |
44 | 44 | } |
45 | 45 | $lang = new $langclass; |
46 | 46 | |
Index: trunk/phase3/maintenance/importUseModWiki.php |
— | — | @@ -27,7 +27,8 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | if( php_sapi_name() != 'cli' ) { |
31 | | - die( "Please customize the settings and run me from the command line." ); |
| 31 | + echo "Please customize the settings and run me from the command line."; |
| 32 | + die( -1 ); |
32 | 33 | } |
33 | 34 | |
34 | 35 | /** Set these correctly! */ |
— | — | @@ -124,7 +125,8 @@ |
125 | 126 | |
126 | 127 | $fname = $wgRootDirectory . "/page/" . useModFilename( $title ) . ".db"; |
127 | 128 | if( !file_exists( $fname ) ) { |
128 | | - die( "Couldn't open file '$fname' for page '$title'.\n" ); |
| 129 | + echo "Couldn't open file '$fname' for page '$title'.\n"; |
| 130 | + die( -1 ); |
129 | 131 | } |
130 | 132 | |
131 | 133 | $page = splitHash( $FS1, file_get_contents( $fname ) ); |
Index: trunk/phase3/maintenance/diffLanguage.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | require_once( 'parserTests.inc' ); |
45 | 45 | require_once( 'commandLine.inc' ); |
46 | 46 | |
47 | | -if( isset($options['help']) ) { usage(); die(); } |
| 47 | +if( isset($options['help']) ) { usage(); wfDie(); } |
48 | 48 | |
49 | 49 | $wgLanguageCode = ucfirstlcrest($wgLanguageCode); |
50 | 50 | /** Language messages we will use as reference. By default 'en' */ |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | print "Including $langFile\n"; |
87 | 87 | global $wgNamespaceNamesEn; |
88 | 88 | include($langFile); |
89 | | - } else die("ERROR: The file $langFile does not exist !\n"); |
| 89 | + } else wfDie("ERROR: The file $langFile does not exist !\n"); |
90 | 90 | } |
91 | 91 | return $$foo; |
92 | 92 | } |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | $testLanguage = $lang; |
126 | 126 | } else { |
127 | 127 | usage(); |
128 | | - die(); |
| 128 | + wfDie(); |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** parsertest is used to do differences */ |
Index: trunk/phase3/maintenance/cleanupTitles.php |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | $title = $verified; |
179 | 179 | } |
180 | 180 | if( is_null( $title ) ) { |
181 | | - die( "Something awry; empty title.\n" ); |
| 181 | + wfDie( "Something awry; empty title.\n" ); |
182 | 182 | } |
183 | 183 | $ns = $title->getNamespace(); |
184 | 184 | $dest = $title->getDbKey(); |
Index: trunk/phase3/maintenance/parserTestsParserHook.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * A basic extension that's used by the parser tests to test whether input and |
7 | 7 | * arguments are passed to extensions properly. |
Index: trunk/phase3/maintenance/rebuildInterwiki.inc |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | $lines = array_map( 'trim', explode( "\n", trim( $intermap ) ) ); |
104 | 104 | |
105 | 105 | if ( !$lines || count( $lines ) < 2 ) { |
106 | | - die( "m:Interwiki_map not found" ); |
| 106 | + wfDie( "m:Interwiki_map not found" ); |
107 | 107 | } |
108 | 108 | |
109 | 109 | $iwArray = array(); |
Index: trunk/phase3/maintenance/commandLine.inc |
— | — | @@ -42,7 +42,8 @@ |
43 | 43 | if ( in_array( $option, $optionsWithArgs ) ) { |
44 | 44 | $param = next( $argv ); |
45 | 45 | if ( $param === false ) { |
46 | | - die( "$arg needs an value after it\n" ); |
| 46 | + echo "$arg needs an value after it\n"; |
| 47 | + die( -1 ); |
47 | 48 | } |
48 | 49 | $options[$option] = $param; |
49 | 50 | } else { |
— | — | @@ -62,7 +63,8 @@ |
63 | 64 | if ( in_array( $option, $optionsWithArgs ) ) { |
64 | 65 | $param = next( $argv ); |
65 | 66 | if ( $param === false ) { |
66 | | - die( "$arg needs an value after it\n" ); |
| 67 | + echo "$arg needs an value after it\n"; |
| 68 | + die( -1 ); |
67 | 69 | } |
68 | 70 | $options[$option] = $param; |
69 | 71 | } else { |
Index: trunk/phase3/maintenance/addwiki.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | require_once( "rebuildInterwiki.inc" ); |
8 | 8 | require_once( "languages/Names.php" ); |
9 | 9 | if ( count( $args ) != 3 ) { |
10 | | - die( "Usage: php addwiki.php <language> <site> <dbname>\n" ); |
| 10 | + wfDie( "Usage: php addwiki.php <language> <site> <dbname>\n" ); |
11 | 11 | } |
12 | 12 | |
13 | 13 | addWiki( $args[0], $args[1], $args[2] ); |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | $tempname = tempnam( '/tmp', 'addwiki' ); |
199 | 199 | $file = fopen( $tempname, 'w' ); |
200 | 200 | if ( !$file ) { |
201 | | - die( "Error, unable to open temporary file $tempname\n" ); |
| 201 | + wfDie( "Error, unable to open temporary file $tempname\n" ); |
202 | 202 | } |
203 | 203 | fwrite( $file, $sql ); |
204 | 204 | fclose( $file ); |
Index: trunk/phase3/maintenance/storage/compressOld.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | if( !function_exists( "gzdeflate" ) ) { |
40 | 40 | print "You must enable zlib support in PHP to compress old revisions!\n"; |
41 | 41 | print "Please see http://www.php.net/manual/en/ref.zlib.php\n\n"; |
42 | | - die(); |
| 42 | + wfDie(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | $defaults = array( |
Index: trunk/phase3/maintenance/transstat.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | require_once('commandLine.inc'); |
17 | 17 | require_once('languages.inc'); |
18 | 18 | |
19 | | -if( isset($options['help']) ) { usage(); die(); } |
| 19 | +if( isset($options['help']) ) { usage(); wfDie(); } |
20 | 20 | // default output is WikiText |
21 | 21 | if( !isset($options['output']) ) { $options['output']='wiki'; } |
22 | 22 | |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | case 'wiki': |
123 | 123 | $out = new wikiStatsOutput(); break; |
124 | 124 | default: |
125 | | - usage(); die(); |
| 125 | + usage(); wfDie(); |
126 | 126 | break; |
127 | 127 | } |
128 | 128 | |
Index: trunk/phase3/maintenance/benchmarkPurge.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | if( !$wgUseSquid ) { |
51 | | - die( "Squid purge benchmark doesn't do much without squid support on.\n" ); |
| 51 | + wfDie( "Squid purge benchmark doesn't do much without squid support on.\n" ); |
52 | 52 | } else { |
53 | 53 | printf( "There are %d defined squid servers:\n", count( $wgSquidServers ) ); |
54 | 54 | #echo implode( "\n", $wgSquidServers ) . "\n"; |
Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | function runTestsFromFile( $filename ) { |
123 | 123 | $infile = fopen( $filename, 'rt' ); |
124 | 124 | if( !$infile ) { |
125 | | - die( "Couldn't open parserTests.txt\n" ); |
| 125 | + wfDie( "Couldn't open parserTests.txt\n" ); |
126 | 126 | } |
127 | 127 | |
128 | 128 | $data = array(); |
— | — | @@ -135,10 +135,10 @@ |
136 | 136 | $section = strtolower( $matches[1] ); |
137 | 137 | if( $section == 'endarticle') { |
138 | 138 | if( !isset( $data['text'] ) ) { |
139 | | - die( "'endarticle' without 'text' at line $n\n" ); |
| 139 | + wfDie( "'endarticle' without 'text' at line $n\n" ); |
140 | 140 | } |
141 | 141 | if( !isset( $data['article'] ) ) { |
142 | | - die( "'endarticle' without 'article' at line $n\n" ); |
| 142 | + wfDie( "'endarticle' without 'article' at line $n\n" ); |
143 | 143 | } |
144 | 144 | $this->addArticle($this->chomp($data['article']), $this->chomp($data['text']), $n); |
145 | 145 | $data = array(); |
— | — | @@ -147,13 +147,13 @@ |
148 | 148 | } |
149 | 149 | if( $section == 'end' ) { |
150 | 150 | if( !isset( $data['test'] ) ) { |
151 | | - die( "'end' without 'test' at line $n\n" ); |
| 151 | + wfDie( "'end' without 'test' at line $n\n" ); |
152 | 152 | } |
153 | 153 | if( !isset( $data['input'] ) ) { |
154 | | - die( "'end' without 'input' at line $n\n" ); |
| 154 | + wfDie( "'end' without 'input' at line $n\n" ); |
155 | 155 | } |
156 | 156 | if( !isset( $data['result'] ) ) { |
157 | | - die( "'end' without 'result' at line $n\n" ); |
| 157 | + wfDie( "'end' without 'result' at line $n\n" ); |
158 | 158 | } |
159 | 159 | if( !isset( $data['options'] ) ) { |
160 | 160 | $data['options'] = ''; |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | if ( isset ($data[$section] ) ) { |
185 | | - die ( "duplicate section '$section' at line $n\n" ); |
| 185 | + wfDie( "duplicate section '$section' at line $n\n" ); |
186 | 186 | } |
187 | 187 | $data[$section] = ''; |
188 | 188 | continue; |
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | print $this->termReset() . "\n"; |
203 | 203 | return ($success == $total); |
204 | 204 | } else { |
205 | | - die( "No tests found.\n" ); |
| 205 | + wfDie( "No tests found.\n" ); |
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
— | — | @@ -386,7 +386,7 @@ |
387 | 387 | . $wgDBprefix . $tbl .'`', $create); |
388 | 388 | if ($create === $create_tmp) { |
389 | 389 | # Couldn't do replacement |
390 | | - die("could not create temporary table $tbl"); |
| 390 | + wfDie("could not create temporary table $tbl"); |
391 | 391 | } |
392 | 392 | $db->query($create_tmp); |
393 | 393 | } |
— | — | @@ -638,12 +638,12 @@ |
639 | 639 | $this->setupGlobals(); |
640 | 640 | $title = Title::newFromText( $name ); |
641 | 641 | if ( is_null($title) ) { |
642 | | - die( "invalid title at line $line\n" ); |
| 642 | + wfDie( "invalid title at line $line\n" ); |
643 | 643 | } |
644 | 644 | |
645 | 645 | $aid = $title->getArticleID( GAID_FOR_UPDATE ); |
646 | 646 | if ($aid != 0) { |
647 | | - die( "duplicate article at line $line\n" ); |
| 647 | + wfDie( "duplicate article at line $line\n" ); |
648 | 648 | } |
649 | 649 | |
650 | 650 | $art = new Article($title); |
Index: trunk/phase3/maintenance/lang2po.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | define('LOCALE_OUTPUT_DIR', $IP.'/locale'); |
24 | 24 | |
25 | 25 | |
26 | | -if( isset($options['help']) ) { usage(); die(); } |
| 26 | +if( isset($options['help']) ) { usage(); wfDie(); } |
27 | 27 | // default output is WikiText |
28 | 28 | if( !isset($options['lang']) ) { $options['lang'] = ALL_LANGUAGES; } |
29 | 29 | |
Index: trunk/phase3/maintenance/mwdocgen.php |
— | — | @@ -23,7 +23,8 @@ |
24 | 24 | # |
25 | 25 | |
26 | 26 | if( php_sapi_name() != 'cli' ) { |
27 | | - die( "Run me from the command line." ); |
| 27 | + echo "Run me from the command line."; |
| 28 | + die( -1 ); |
28 | 29 | } |
29 | 30 | |
30 | 31 | /** Phpdoc script with full path */ |
Index: trunk/phase3/maintenance/langmemusage.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | $langtool = new languages(); |
13 | 13 | |
14 | 14 | if ( ! function_exists( 'memory_get_usage' ) ) |
15 | | - die( "You must compile PHP with --enable-memory-limit\n" ); |
| 15 | + wfDie( "You must compile PHP with --enable-memory-limit\n" ); |
16 | 16 | |
17 | 17 | $memlast = $memstart = memory_get_usage(); |
18 | 18 | |
Index: trunk/phase3/maintenance/parserTestsParserTime.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * A basic extension that's used by the parser tests to test date magic words |
7 | 7 | * |
Index: trunk/phase3/maintenance/generateSitemap.php |
— | — | @@ -441,7 +441,7 @@ |
442 | 442 | } |
443 | 443 | |
444 | 444 | if ( in_array( '--help', $argv ) ) |
445 | | - die( |
| 445 | + wfDie( |
446 | 446 | "Usage: php generateSitemap.php [host] [options]\n" . |
447 | 447 | "\thost = hostname\n" . |
448 | 448 | "\toptions:\n" . |
Index: trunk/phase3/img_auth.php |
— | — | @@ -11,7 +11,8 @@ |
12 | 12 | define( 'MEDIAWIKI', true ); |
13 | 13 | |
14 | 14 | if ( isset( $_REQUEST['GLOBALS'] ) ) { |
15 | | - die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'); |
| 15 | + echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'; |
| 16 | + die( -1 ); |
16 | 17 | } |
17 | 18 | |
18 | 19 | require_once( 'includes/Defines.php' ); |
Index: trunk/phase3/redirect.php |
— | — | @@ -4,7 +4,8 @@ |
5 | 5 | $wgCommandLineMode = false; |
6 | 6 | define( 'MEDIAWIKI', true ); |
7 | 7 | if ( isset( $_REQUEST['GLOBALS'] ) ) { |
8 | | - die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'); |
| 8 | + echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'; |
| 9 | + die( -1 ); |
9 | 10 | } |
10 | 11 | |
11 | 12 | require_once( './includes/Defines.php' ); |
Index: trunk/phase3/skins/MySkin.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** */ |
15 | 15 | require_once('MonoBook.php'); |
Index: trunk/phase3/skins/Chick.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** */ |
15 | 15 | require_once('MonoBook.php'); |
Index: trunk/phase3/skins/Nostalgia.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @todo document |
Index: trunk/phase3/skins/disabled/HTMLDump.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | if( !defined( 'MEDIAWIKI' ) ) |
9 | | - die(); |
| 9 | + die( -1 ); |
10 | 10 | |
11 | 11 | /** */ |
12 | 12 | require_once( 'includes/SkinTemplate.php' ); |
Index: trunk/phase3/skins/disabled/Amethyst.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | */ |
12 | 12 | |
13 | 13 | if( !defined( 'MEDIAWIKI' ) ) |
14 | | - die(); |
| 14 | + die( -1 ); |
15 | 15 | |
16 | 16 | /** Skin reuse monobook template */ |
17 | 17 | require_once('MonoBook.php'); |
Index: trunk/phase3/skins/disabled/Chick.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** */ |
15 | 15 | require_once('includes/SkinPHPTal.php'); |
Index: trunk/phase3/skins/disabled/MonoBookTal.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | */ |
17 | 17 | |
18 | 18 | if( !defined( 'MEDIAWIKI' ) ) |
19 | | - die(); |
| 19 | + die( -1 ); |
20 | 20 | |
21 | 21 | /** */ |
22 | 22 | require_once('includes/SkinPHPTal.php'); |
Index: trunk/phase3/skins/disabled/WikimediaWiki.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | if( !defined( 'MEDIAWIKI' ) ) |
11 | | - die(); |
| 11 | + die( -1 ); |
12 | 12 | |
13 | 13 | /** */ |
14 | 14 | |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | */ |
13 | 13 | |
14 | 14 | if( !defined( 'MEDIAWIKI' ) ) |
15 | | - die(); |
| 15 | + die( -1 ); |
16 | 16 | |
17 | 17 | /** */ |
18 | 18 | require_once('includes/SkinTemplate.php'); |
Index: trunk/phase3/skins/Simple.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** */ |
15 | 15 | require_once('MonoBook.php'); |
Index: trunk/phase3/skins/CologneBlue.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @todo document |
Index: trunk/phase3/skins/Standard.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | if( !defined( 'MEDIAWIKI' ) ) |
12 | | - die(); |
| 12 | + die( -1 ); |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @todo document |
Index: trunk/phase3/profileinfo.php |
— | — | @@ -49,19 +49,21 @@ |
50 | 50 | define("MEDIAWIKI", 1); |
51 | 51 | if ( isset( $_REQUEST['GLOBALS'] ) ) { |
52 | 52 | print $GLOBALS; |
53 | | - die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'); |
| 53 | + echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'; |
| 54 | + die( -1 ); |
54 | 55 | } |
55 | 56 | |
56 | 57 | require_once("./includes/Defines.php"); |
57 | 58 | require_once("./LocalSettings.php"); |
58 | 59 | require_once("./AdminSettings.php"); |
59 | 60 | |
60 | | -if (!$wgEnableProfileInfo) |
61 | | - die("disabled"); |
| 61 | +if (!$wgEnableProfileInfo) { |
| 62 | + wfDie("disabled"); |
| 63 | +} |
62 | 64 | |
63 | 65 | foreach (array("wgDBadminuser", "wgDBadminpassword", "wgDBserver", "wgDBname") as $var) |
64 | 66 | if ($$var === false) |
65 | | - die("AdminSettings.php not correct"); |
| 67 | + wfDie("AdminSettings.php not correct"); |
66 | 68 | |
67 | 69 | $expand = array(); |
68 | 70 | if (isset($_REQUEST['expand'])) |
— | — | @@ -155,13 +157,13 @@ |
156 | 158 | $sort = $_REQUEST['sort']; |
157 | 159 | |
158 | 160 | $dbh = mysql_connect($wgDBserver, $wgDBadminuser, $wgDBadminpassword) |
159 | | - or die("mysql server failed: " . mysql_error()); |
160 | | -mysql_select_db($wgDBname, $dbh) or die(mysql_error($dbh)); |
| 161 | + or wfDie("mysql server failed: " . mysql_error()); |
| 162 | +mysql_select_db($wgDBname, $dbh) or wfDie(mysql_error($dbh)); |
161 | 163 | $res = mysql_query(" |
162 | 164 | SELECT pf_count, pf_time, pf_name |
163 | 165 | FROM profiling |
164 | 166 | ORDER BY pf_name ASC |
165 | | -", $dbh) or die("query failed: " . mysql_error()); |
| 167 | +", $dbh) or wfDie("query failed: " . mysql_error()); |
166 | 168 | |
167 | 169 | if (isset($_REQUEST['filter'])) |
168 | 170 | $filter = $_REQUEST['filter']; |
Index: trunk/phase3/tests/RunTests.php |
— | — | @@ -1,7 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | if( php_sapi_name() != 'cli' ) { |
5 | | - die( 'Must be run from the command line.' ); |
| 5 | + echo 'Must be run from the command line.'; |
| 6 | + die( -1 ); |
6 | 7 | } |
7 | 8 | |
8 | 9 | error_reporting( E_ALL ); |
— | — | @@ -74,7 +75,7 @@ |
75 | 76 | . $wgDBprefix . '\\1`', $create); |
76 | 77 | if ($create === $create_tmp) { |
77 | 78 | # Couldn't do replacement |
78 | | - die("could not create temporary table $tbl"); |
| 79 | + wfDie( "could not create temporary table $tbl" ); |
79 | 80 | } |
80 | 81 | $db->query($create_tmp); |
81 | 82 | } |
Index: trunk/phase3/thumb.php |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | define( 'MEDIAWIKI', true ); |
10 | 10 | unset( $IP ); |
11 | 11 | if ( isset( $_REQUEST['GLOBALS'] ) ) { |
12 | | - die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'); |
| 12 | + echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'; |
| 13 | + die( -1 ); |
13 | 14 | } |
14 | 15 | |
15 | 16 | $wgNoOutputBuffer = true; |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | */ |
436 | 436 | function loadDefaultTables() { |
437 | 437 | $name = get_class($this); |
438 | | - die("Must implement loadDefaultTables() method in class $name"); |
| 438 | + wfDie("Must implement loadDefaultTables() method in class $name"); |
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -484,6 +484,8 @@ |
485 | 485 | * Add wfClone() wrapper since we're still using PHP 4 on some servers. |
486 | 486 | * Fixed installer bugs 921 and 3914 (issues with using root and so forth) |
487 | 487 | * Remove obsolete killthread.php |
| 488 | +* Added wfDie() wrapper, and some manual die(-1), to force the return code |
| 489 | + to the shell to return nonzero when we crap out with an error. |
488 | 490 | |
489 | 491 | |
490 | 492 | === Caveats === |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -255,7 +255,7 @@ |
256 | 256 | |
257 | 257 | # Otherwise we get a suppressed fatal error, which is very hard to track down |
258 | 258 | if ( !function_exists( 'mysql_connect' ) ) { |
259 | | - die( "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n" ); |
| 259 | + wfDie( "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n" ); |
260 | 260 | } |
261 | 261 | |
262 | 262 | $this->close(); |
Index: trunk/phase3/includes/SkinPHPTal.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | # This program is free software; you can redistribute it and/or modify |
6 | 6 | # it under the terms of the GNU General Public License as published by |
7 | 7 | # the Free Software Foundation; either version 2 of the License, or |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * Provide things related to namespaces |
7 | 7 | * @package MediaWiki |
Index: trunk/phase3/includes/HistoryBlob.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | |
61 | 61 | function ConcatenatedGzipHistoryBlob() { |
62 | 62 | if ( !function_exists( 'gzdeflate' ) ) { |
63 | | - die( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" ); |
| 63 | + wfDie( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" ); |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * @package MediaWiki |
7 | 7 | */ |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -18,7 +18,8 @@ |
19 | 19 | |
20 | 20 | // Check to see if we are at the file scope |
21 | 21 | if ( !isset( $wgVersion ) ) { |
22 | | - die( "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n" ); |
| 22 | + echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n"; |
| 23 | + die( -1 ); |
23 | 24 | } |
24 | 25 | |
25 | 26 | if( !isset( $wgProfiling ) ) |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | |
6 | 6 | # This program is free software; you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
Index: trunk/phase3/includes/ObjectCache.php |
— | — | @@ -5,7 +5,10 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | /** */ |
9 | | -if (!defined('MEDIAWIKI')) die( "Not a valid entry point\n"); |
| 9 | +if (!defined('MEDIAWIKI')) { |
| 10 | + echo "Not a valid entry point\n"; |
| 11 | + die( -1 ); |
| 12 | +} |
10 | 13 | |
11 | 14 | |
12 | 15 | /** |
Index: trunk/phase3/includes/DatabaseOracle.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | */ |
54 | 54 | function open( $server, $user, $password, $dbName ) { |
55 | 55 | if ( !function_exists( 'oci_connect' ) ) { |
56 | | - die( "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" ); |
| 56 | + wfDie( "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n" ); |
57 | 57 | } |
58 | 58 | $this->close(); |
59 | 59 | $this->mServer = $server; |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -20,7 +20,8 @@ |
21 | 21 | |
22 | 22 | # This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined |
23 | 23 | if( !defined( 'MEDIAWIKI' ) ) { |
24 | | - die( "This file is part of MediaWiki and is not a valid entry point\n" ); |
| 24 | + echo "This file is part of MediaWiki and is not a valid entry point\n"; |
| 25 | + die( -1 ); |
25 | 26 | } |
26 | 27 | |
27 | 28 | /** |
Index: trunk/phase3/includes/Categoryfinder.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | */ |
23 | 23 | |
24 | 24 | |
25 | | -if( !defined( 'MEDIAWIKI' ) ) die(); |
| 25 | +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); |
26 | 26 | |
27 | 27 | class Categoryfinder { |
28 | 28 | |
Index: trunk/phase3/includes/Hooks.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * Hooks.php -- a tool for running hook functions |
7 | 7 | * Copyright 2004, 2005 Evan Prodromou <evan@wikitravel.org>. |
Index: trunk/phase3/includes/PersistentObject.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * Sometimes one wants to make an extension that defines a class that one wants |
7 | 7 | * to backreference somewhere else in the code, doing something like: |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * @package MediaWiki |
Index: trunk/phase3/includes/SpecialPreferences.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | */ |
8 | 8 | |
9 | 9 | if( !defined( 'MEDIAWIKI' ) ) |
10 | | - die(); |
| 10 | + die( -1 ); |
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Entry point that create the "Preferences" object |
Index: trunk/phase3/includes/compatability/ctype.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * PHP <4.2.0 doesn't build ctype_ functions by default and Gentoo doesn't |
7 | 7 | * build it by default, and that probably applies for some other distributions |
Index: trunk/phase3/includes/proxy_check.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | if( php_sapi_name() != 'cli' ) { |
9 | | - die(''); |
| 9 | + die( -1 ); |
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
Index: trunk/phase3/includes/BagOStuff.php |
— | — | @@ -293,14 +293,14 @@ |
294 | 294 | return $str; |
295 | 295 | } |
296 | 296 | function _doinsert($table, $vals) { |
297 | | - die( 'abstract function SqlBagOStuff::_doinsert() must be defined' ); |
| 297 | + wfDie( 'abstract function SqlBagOStuff::_doinsert() must be defined' ); |
298 | 298 | } |
299 | 299 | function _doquery($sql) { |
300 | | - die( 'abstract function SqlBagOStuff::_doquery() must be defined' ); |
| 300 | + wfDie( 'abstract function SqlBagOStuff::_doquery() must be defined' ); |
301 | 301 | } |
302 | 302 | |
303 | 303 | function _fetchrow($res) { |
304 | | - die( 'abstract function SqlBagOStuff::_fetchrow() must be defined' ); |
| 304 | + wfDie( 'abstract function SqlBagOStuff::_fetchrow() must be defined' ); |
305 | 305 | } |
306 | 306 | |
307 | 307 | function _freeresult($result) { |
— | — | @@ -314,11 +314,11 @@ |
315 | 315 | } |
316 | 316 | |
317 | 317 | function _maxdatetime() { |
318 | | - die( 'abstract function SqlBagOStuff::_maxdatetime() must be defined' ); |
| 318 | + wfDie( 'abstract function SqlBagOStuff::_maxdatetime() must be defined' ); |
319 | 319 | } |
320 | 320 | |
321 | 321 | function _fromunixtime() { |
322 | | - die( 'abstract function SqlBagOStuff::_fromunixtime() must be defined' ); |
| 322 | + wfDie( 'abstract function SqlBagOStuff::_fromunixtime() must be defined' ); |
323 | 323 | } |
324 | 324 | |
325 | 325 | function garbageCollect() { |
— | — | @@ -427,7 +427,7 @@ |
428 | 428 | /* This is actually a hack, we should be able |
429 | 429 | to use Language classes here... or not */ |
430 | 430 | if (!$dbw) |
431 | | - die("Could not connect to database"); |
| 431 | + wfDie("Could not connect to database"); |
432 | 432 | $this->table = $dbw->tableName( $this->table ); |
433 | 433 | $this->tableInitialised = true; |
434 | 434 | } |
Index: trunk/phase3/includes/DatabasePostgreSQL.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | function open( $server, $user, $password, $dbName ) { |
47 | 47 | # Test for PostgreSQL support, to avoid suppressed fatal error |
48 | 48 | if ( !function_exists( 'pg_connect' ) ) { |
49 | | - die( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" ); |
| 49 | + wfDie( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | global $wgDBschema; |
Index: trunk/phase3/includes/CategoryPage.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | if( !defined( 'MEDIAWIKI' ) ) |
11 | | - die(); |
| 11 | + die( -1 ); |
12 | 12 | |
13 | 13 | global $wgCategoryMagicGallery; |
14 | 14 | if( $wgCategoryMagicGallery ) |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * |
9 | 9 | */ |
10 | 10 | if( !defined( 'MEDIAWIKI' ) ) |
11 | | - die(); |
| 11 | + die( -1 ); |
12 | 12 | |
13 | 13 | require_once( 'Image.php' ); |
14 | 14 | |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -588,7 +588,7 @@ |
589 | 589 | $ns = intval( $key ); |
590 | 590 | $this->namespaces[$ns] = true; |
591 | 591 | } else { |
592 | | - die( "Unrecognized namespace key '$key'\n" ); |
| 592 | + wfDie( "Unrecognized namespace key '$key'\n" ); |
593 | 593 | } |
594 | 594 | } |
595 | 595 | } |
Index: trunk/phase3/includes/normal/UtfNormalUtil.php |
— | — | @@ -47,7 +47,8 @@ |
48 | 48 | chr($codepoint >> 6 & 0x3f | 0x80) . |
49 | 49 | chr($codepoint & 0x3f | 0x80); |
50 | 50 | |
51 | | - die("Asked for code outside of range ($codepoint)\n"); |
| 51 | + echo "Asked for code outside of range ($codepoint)\n"; |
| 52 | + die( -1 ); |
52 | 53 | } |
53 | 54 | |
54 | 55 | /** |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -582,6 +582,16 @@ |
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
| 586 | + * Print a simple message and die, returning nonzero to the shell if any. |
| 587 | + * Plain die() fails to return nonzero to the shell if you pass a string. |
| 588 | + * @param string $msg |
| 589 | + */ |
| 590 | +function wfDie( $msg='' ) { |
| 591 | + echo $msg; |
| 592 | + die( -1 ); |
| 593 | +} |
| 594 | + |
| 595 | +/** |
586 | 596 | * Die with a backtrace |
587 | 597 | * This is meant as a debugging aid to track down where bad data comes from. |
588 | 598 | * Shouldn't be used in production code except maybe in "shouldn't happen" areas. |
— | — | @@ -1763,4 +1773,5 @@ |
1764 | 1774 | return $string; |
1765 | 1775 | } |
1766 | 1776 | |
| 1777 | + |
1767 | 1778 | ?> |
Index: trunk/phase3/includes/Exif.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if ( !defined( 'MEDIAWIKI' ) ) die(); |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die( -1 ); |
4 | 4 | /** |
5 | 5 | * @package MediaWiki |
6 | 6 | * @subpackage Metadata |
Index: trunk/phase3/includes/ProxyTools.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | if ( ! defined( 'MEDIAWIKI' ) ) |
4 | | - die(); |
| 4 | + die( -1 ); |
5 | 5 | /** |
6 | 6 | * Functions for dealing with proxies |
7 | 7 | * @package MediaWiki |
Index: trunk/phase3/includes/templates/Confirmemail.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * @package MediaWiki |
5 | 5 | * @subpackage Templates |
6 | 6 | */ |
7 | | -if( !defined( 'MEDIAWIKI' ) ) die(); |
| 7 | +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); |
8 | 8 | |
9 | 9 | /** */ |
10 | 10 | require_once( 'includes/SkinTemplate.php' ); |
Index: trunk/phase3/includes/templates/Userlogin.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * @package MediaWiki |
5 | 5 | * @subpackage Templates |
6 | 6 | */ |
7 | | -if( !defined( 'MEDIAWIKI' ) ) die(); |
| 7 | +if( !defined( 'MEDIAWIKI' ) ) die( -1 ); |
8 | 8 | |
9 | 9 | /** */ |
10 | 10 | require_once( 'includes/SkinTemplate.php' ); |
Index: trunk/phase3/trackback.php |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | unset($IP); |
10 | 10 | define('MEDIAWIKI', true); |
11 | 11 | if ( isset( $_REQUEST['GLOBALS'] ) ) { |
12 | | - die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'); |
| 12 | + echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>'; |
| 13 | + die( -1 ); |
13 | 14 | } |
14 | 15 | |
15 | 16 | require_once('./includes/Defines.php'); |