OSDN Git Service

handle wpdb error ourselves, instead of waiting for dead_db()
authorscribu <mail@scribu.net>
Mon, 11 Mar 2013 16:32:38 +0000 (18:32 +0200)
committerscribu <mail@scribu.net>
Mon, 11 Mar 2013 16:33:42 +0000 (18:33 +0200)
php/wp-settings-cli.php

index dd64be7..12321c1 100644 (file)
@@ -61,6 +61,10 @@ Utils\replace_wp_die_handler();
 // Include the wpdb class and, if present, a db.php database drop-in.
 require_wp_db();
 
+// WP-CLI: Handle db error ourselves, instead of waiting for dead_db()
+if ( !empty( $wpdb->error ) )
+       wp_die( $wpdb->error );
+
 // Set the database table prefix and the format specifiers for database table columns.
 $GLOBALS['table_prefix'] = $table_prefix;
 wp_set_wpdb_vars();