From: Chad Horohoe Date: Thu, 21 Nov 2013 23:22:47 +0000 (-0800) Subject: Handle CDB errors more gracefully in cdb.php maintenance script X-Git-Tag: 1.31.0-rc.0~17969^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=ac00050e37846348f7bebe7129ba35957be9d04d;p=lhc%2Fweb%2Fwiklou.git Handle CDB errors more gracefully in cdb.php maintenance script Change-Id: I9be42c909c85cd454fdd10921c8d50d6273252f8 --- diff --git a/maintenance/cdb.php b/maintenance/cdb.php index d42f9f7a88..bda64f3eab 100644 --- a/maintenance/cdb.php +++ b/maintenance/cdb.php @@ -75,7 +75,10 @@ do { } $file = $args[0]; print "Loading cdb file $file..."; - $fileHandle = CdbReader::open( $file ); + try { + $fileHandle = CdbReader::open( $file ); + } catch( CdbException $e ) {} + if ( !$fileHandle ) { print "not a cdb file or unable to read it\n"; } else { @@ -91,7 +94,11 @@ do { print "Need to specify a key, Luke\n"; break; } - $res = $fileHandle->get( $args[0] ); + try { + $res = $fileHandle->get( $args[0] ); + } catch ( CdbException $e ) { + print "Unable to read key from file\n"; + } if ( $res === false ) { print "No such key/value pair\n"; } elseif ( is_string( $res ) ) {