jenkins-bot has submitted this change and it was merged.

Change subject: Handle CDB errors more gracefully in cdb.php maintenance script
......................................................................


Handle CDB errors more gracefully in cdb.php maintenance script

Change-Id: I9be42c909c85cd454fdd10921c8d50d6273252f8
---
M maintenance/cdb.php
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/cdb.php b/maintenance/cdb.php
index d42f9f7..bda64f3 100644
--- a/maintenance/cdb.php
+++ b/maintenance/cdb.php
@@ -75,7 +75,10 @@
                        }
                        $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 @@
                                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 ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/96907
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9be42c909c85cd454fdd10921c8d50d6273252f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to