https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115113
Revision: 115113 Author: aaron Date: 2012-05-02 23:35:21 +0000 (Wed, 02 May 2012) Log Message: ----------- Throw exceptions instead of dying, so they can be caught. Modified Paths: -------------- trunk/tools/mwmultiversion/multiversion/MWWikiversions.php Modified: trunk/tools/mwmultiversion/multiversion/MWWikiversions.php =================================================================== --- trunk/tools/mwmultiversion/multiversion/MWWikiversions.php 2012-05-02 19:49:15 UTC (rev 115112) +++ trunk/tools/mwmultiversion/multiversion/MWWikiversions.php 2012-05-02 23:35:21 UTC (rev 115113) @@ -12,12 +12,12 @@ public static function readWikiVersionsFile( $srcPath ) { $data = file_get_contents( $srcPath ); if ( $data === false ) { - die( "Unable to read $srcPath.\n" ); + throw new Exception( "Unable to read $srcPath.\n" ); } // Read the lines of the dat file into an array... $verList = explode( "\n", $data ); if ( !count( $verList ) ) { - die( "Empty table in $srcPath.\n" ); + throw new Exception( "Empty table in $srcPath.\n" ); } // Convert each raw line into a row array... $result = array(); @@ -54,12 +54,12 @@ list( $dbName, $version ) = $items; $extVersion = '*'; // none } else { - die( "Invalid row on line $lineNo ('$line').\n" ); + throw new Exception( "Invalid row on line $lineNo ('$line').\n" ); } // Sanity check version directory if ( !is_dir( MULTIVER_COMMON_HOME . '/' . $version ) ) { - die( "Invalid version dir on line $lineNo ('$line').\n" ); + throw new Exception( "Invalid version dir on line $lineNo ('$line').\n" ); } return array( $dbName, $version, $extVersion, $comment ); @@ -87,7 +87,7 @@ public static function readDbListFile( $srcPath ) { $data = file_get_contents( $srcPath ); if ( $data === false ) { - die( "Unable to read $srcPath.\n" ); + throw new Exception( "Unable to read $srcPath.\n" ); } return array_flip( array_filter( explode( "\n", $data ) ) ); } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs