dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Split DateInputWidget & CalendarWidget into a separate ResourceLoader module"
[lhc/web/wiklou.git]
/
maintenance
/
cdb.php
diff --git
a/maintenance/cdb.php
b/maintenance/cdb.php
index
9e56e1b
..
2e252ad
100644
(file)
--- a/
maintenance/cdb.php
+++ b/
maintenance/cdb.php
@@
-21,9
+21,11
@@
* @todo document
* @ingroup Maintenance
*/
* @todo document
* @ingroup Maintenance
*/
+use \Cdb\Exception as CdbException;
+use \Cdb\Reader as CdbReader;
/** */
/** */
-require_once
( __DIR__ . '/commandLine.inc' )
;
+require_once
__DIR__ . '/commandLine.inc'
;
function cdbShowHelp( $command ) {
$commandList = array(
function cdbShowHelp( $command ) {
$commandList = array(
@@
-52,7
+54,7
@@
do {
$bad = false;
$showhelp = false;
$quit = false;
$bad = false;
$showhelp = false;
$quit = false;
- static $fileHandle;
+ static $fileHandle
= false
;
$line = Maintenance::readconsole();
if ( $line === false ) {
$line = Maintenance::readconsole();
if ( $line === false ) {
@@
-75,7
+77,11
@@
do {
}
$file = $args[0];
print "Loading cdb file $file...";
}
$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 {
if ( !$fileHandle ) {
print "not a cdb file or unable to read it\n";
} else {
@@
-91,7
+97,12
@@
do {
print "Need to specify a key, Luke\n";
break;
}
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 ) ) {
if ( $res === false ) {
print "No such key/value pair\n";
} elseif ( is_string( $res ) ) {