http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90611
Revision: 90611
Author: demon
Date: 2011-06-22 21:48:46 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
Make Maintenance::error() more useful in dying situations by turning the second
parameter into an int to allow dying errors to specify an exit code. Bool t/f
will still work for b/c
Modified Paths:
--------------
trunk/phase3/maintenance/Maintenance.php
Modified: trunk/phase3/maintenance/Maintenance.php
===================================================================
--- trunk/phase3/maintenance/Maintenance.php 2011-06-22 21:38:32 UTC (rev
90610)
+++ trunk/phase3/maintenance/Maintenance.php 2011-06-22 21:48:46 UTC (rev
90611)
@@ -314,9 +314,9 @@
* Throw an error to the user. Doesn't respect --quiet, so don't use
* this for non-error output
* @param $err String: the error to display
- * @param $die Boolean: If true, go ahead and die out.
+ * @param $die Int: if > 0, go ahead and die out using this int as the
code
*/
- protected function error( $err, $die = false ) {
+ protected function error( $err, $die = 0 ) {
$this->outputChanneled( false );
if ( php_sapi_name() == 'cli' ) {
fwrite( STDERR, $err . "\n" );
@@ -325,8 +325,9 @@
fwrite( $f, $err . "\n" );
fclose( $f );
}
- if ( $die ) {
- die();
+ $die = intval( $die );
+ if ( $die > 0 ) {
+ die( $die );
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs