| @@ -210,9 +210,9 @@ | ||
| 210 | 210 | private function csv_format( $records ) { |
| 211 | 211 | $output = fopen( 'php://output', 'w' ); // @codingStandardsIgnoreLine Clever output for WP CLI using php://output |
| 212 | 212 | |
| 213 | 213 | foreach ( $records as $line ) { |
| 214 | - fputcsv( $output, $line, ',', '"', '\\' ); | |
| 214 | + fputcsv( $output, $line ); | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | fclose( $output ); // @codingStandardsIgnoreLine |
| 218 | 218 | } |
| @@ -222,11 +222,9 @@ | ||
| 222 | 222 | * |
| 223 | 223 | * @return void |
| 224 | 224 | */ |
| 225 | 225 | private function connection() { |
| 226 | - global $wpdb; | |
| 227 | - | |
| 228 | - wp_stream_get_instance()->db->query( | |
| 226 | + $query = wp_stream_get_instance()->db->query( | |
| 229 | 227 | array( |
| 230 | 228 | 'records_per_page' => 1, |
| 231 | 229 | 'fields' => 'created', |
| 232 | 230 | ) |
| @@ -231,12 +229,9 @@ | ||
| 231 | 229 | 'fields' => 'created', |
| 232 | 230 | ) |
| 233 | 231 | ); |
| 234 | 232 | |
| 235 | - // An empty result set is valid (e.g. a fresh site with no logged | |
| 236 | - // activity yet); only a genuine database error means the site is | |
| 237 | - // disconnected. | |
| 238 | - if ( ! empty( $wpdb->last_error ) ) { | |
| 233 | + if ( ! $query ) { | |
| 239 | 234 | \WP_CLI::error( esc_html__( 'SITE IS DISCONNECTED', 'stream' ) ); |
| 240 | 235 | } |
| 241 | 236 | } |
| 242 | 237 | } |