diff --git a/php/wp-settings-cli.php b/php/wp-settings-cli.php
index <HASH>..<HASH> 100644
--- a/php/wp-settings-cli.php
+++ b/php/wp-settings-cli.php
@@ -80,11 +80,14 @@ if ( defined( 'WP_INSTALLING' ) && is_multisite() ) {
 require_wp_db();
 
 // WP-CLI: Handle db error ourselves, instead of waiting for dead_db()
+global $wpdb;
 if ( !empty( $wpdb->error ) )
 	wp_die( $wpdb->error );
 
 // Set the database table prefix and the format specifiers for database table columns.
+// @codingStandardsIgnoreStart
 $GLOBALS['table_prefix'] = $table_prefix;
+// @codingStandardsIgnoreEnd
 wp_set_wpdb_vars();
 
 // Start the WordPress object cache, or an external object cache if the drop-in is present.
@@ -298,6 +301,7 @@ require_once( ABSPATH . WPINC . '/locale.php' );
 $GLOBALS['wp_locale'] = new WP_Locale();
 
 // Load the functions for the active theme, for both parent and child theme if applicable.
+global $pagenow;
 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
 	if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
 		include( STYLESHEETPATH . '/functions.php' );
fix undefined variable warnings in wp-settings-cli.php