Skip to content

Commit 3127f14

Browse files
Run commands after_wp_load
1 parent 072503e commit 3127f14

File tree

5 files changed

+12
-107
lines changed

5 files changed

+12
-107
lines changed

src/Base.php

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/Export.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
use WP_CLI;
77
use WP_SQLite_Translator;
88

9-
class Export extends Base {
9+
class Export {
1010

1111
protected $translator;
1212
protected $args = array();
1313
protected $is_stdout = false;
1414

1515
public function __construct() {
16-
$this->load_dependencies();
1716
$this->translator = new WP_SQLite_Translator();
1817
}
1918

src/Import.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
use WP_CLI;
77
use WP_SQLite_Translator;
88

9-
class Import extends Base {
9+
class Import {
1010

1111
protected $translator;
1212
protected $args;
1313

1414
public function __construct() {
15-
$this->load_dependencies();
1615
$this->translator = new WP_SQLite_Translator();
1716
}
1817

src/SQLite_Command.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use WP_CLI_Command;
77

88
class SQLite_Command extends WP_CLI_Command {
9-
10-
119
/**
1210
* Imports the database to SQLite from an MySQL dump file or from STDIN.
1311
*
@@ -21,15 +19,14 @@ class SQLite_Command extends WP_CLI_Command {
2119
* $ wp sqlite import wordpress_dbase.sql
2220
* Success: Imported from 'import wordpress_dbase.sql'.
2321
*
24-
* @when before_wp_load
22+
* @when after_wp_load
2523
*/
2624
public function import( $args, $assoc_args ) {
27-
2825
if ( empty( $args[0] ) ) {
2926
WP_CLI::error( 'Please provide a file to import.' );
3027
}
3128

32-
if ( ! Import::get_sqlite_plugin_version() ) {
29+
if ( ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) {
3330
WP_CLI::error( 'The SQLite integration plugin is not installed or activated.' );
3431
}
3532

@@ -76,9 +73,13 @@ public function import( $args, $assoc_args ) {
7673
* $ wp sqlite export --exclude_tables=wp_posts,wp_users
7774
* Success: Exported to 'wordpress_dbase.sql'.
7875
*
79-
* @when before_wp_load
76+
* @when after_wp_load
8077
*/
8178
public function export( $args, $assoc_args ) {
79+
if ( ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) {
80+
WP_CLI::error( 'The SQLite integration plugin is not installed or activated.' );
81+
}
82+
8283
$is_porcelain = isset( $assoc_args['porcelain'] );
8384

8485
if ( ! $is_porcelain ) {
@@ -132,10 +133,10 @@ public function export( $args, $assoc_args ) {
132133
* wp_usermeta
133134
* wp_users
134135
*
135-
* @when before_wp_load
136+
* @when after_wp_load
136137
*/
137138
public function tables( $args, $assoc_args ) {
138-
if ( ! Base::get_sqlite_plugin_version() ) {
139+
if ( ! defined( 'SQLITE_DB_DROPIN_VERSION' ) ) {
139140
WP_CLI::error( 'The SQLite integration plugin is not installed or activated.' );
140141
}
141142

src/Tables.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
use PDO;
77
use WP_SQLite_Translator;
88

9-
class Tables extends Base {
9+
class Tables {
1010

1111
protected $translator;
1212

1313
public function __construct() {
14-
$this->load_dependencies();
1514
$this->translator = new WP_SQLite_Translator();
1615
}
1716

0 commit comments

Comments
 (0)