We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cffaa7c + 380ea2d commit 108fbddCopy full SHA for 108fbdd
composer.json
@@ -5,7 +5,7 @@
5
"homepage": "https://github.com/beapi/wp-cli-light-db-export",
6
"license": "MIT",
7
"require": {
8
- "php": ">=5.6"
+ "php": ">=7.0"
9
},
10
"authors": [
11
{
src/wp-cli-light-db-export.php
@@ -185,7 +185,10 @@ class WP_CLI_DB_Light_Export extends WP_CLI_DB_Light_Export_Base {
185
public function export( $positional_args, $assoc_args = [] ) {
186
global $wpdb;
187
188
- $database_name = $wpdb->dbname;
+ $database_name = $wpdb->dbname ?? $wpdb->get_var('SELECT DATABASE();'); // fallback to querying the database if `dbname` is not defined
189
+ if ( empty( $database_name ) ) {
190
+ \WP_CLI::error( "Couldn't get database's name" );
191
+ }
192
193
/**
194
* Filename to export (required)
0 commit comments