diff options
Diffstat (limited to 'maintenance/cdb.php')
-rw-r--r-- | maintenance/cdb.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/maintenance/cdb.php b/maintenance/cdb.php index d42f9f7a..86c686b4 100644 --- a/maintenance/cdb.php +++ b/maintenance/cdb.php @@ -52,7 +52,7 @@ do { $bad = false; $showhelp = false; $quit = false; - static $fileHandle; + static $fileHandle = false; $line = Maintenance::readconsole(); if ( $line === false ) { @@ -75,7 +75,11 @@ 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 +95,12 @@ 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"; + break; + } if ( $res === false ) { print "No such key/value pair\n"; } elseif ( is_string( $res ) ) { |