File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,12 @@ protected function write_sql_statements( $handle ) {
9393 continue ;
9494 }
9595
96+ // Skip internal tables used by the new SQLite driver
97+ // (This is only needed when exporting with the legacy driver.)
98+ if ( 0 === strpos ( $ table_name , '_wp_sqlite_ ' ) ) {
99+ continue ;
100+ }
101+
96102 // Skip tables that are in the exclude_tables list
97103 if ( in_array ( $ table_name , $ exclude_tables , true ) ) {
98104 continue ;
@@ -189,6 +195,8 @@ protected function get_exclude_tables() {
189195 return array_merge (
190196 $ exclude_tables ,
191197 [
198+ // This list is only needed when exporting with the legacy driver.
199+ // In the new SQLite driver, SHOW TABLES never returns these tables.
192200 '_mysql_data_types_cache ' ,
193201 'sqlite_master ' ,
194202 'sqlite_sequence ' ,
Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ public function run( $assoc_args = [] ) {
3636 // and make sure the table names are alphabetically sorted.
3737 if ( $ this ->driver instanceof WP_SQLite_Translator ) {
3838 $ tables_to_exclude = array ( '_mysql_data_types_cache ' , 'sqlite_sequence ' );
39- $ tables = array_diff ( $ tables , $ tables_to_exclude );
39+ foreach ( $ tables as $ table ) {
40+ if ( 0 === strpos ( $ table , '_wp_sqlite_ ' ) ) {
41+ $ tables_to_exclude [] = $ table ;
42+ }
43+ }
44+
45+ $ tables = array_values ( array_diff ( $ tables , $ tables_to_exclude ) );
4046 sort ( $ tables );
4147 }
4248
@@ -49,7 +55,7 @@ public function run( $assoc_args = [] ) {
4955 if ( 'csv ' === $ format ) {
5056 WP_CLI ::line ( implode ( ', ' , $ tables ) );
5157 } elseif ( 'json ' === $ format ) {
52- WP_CLI ::line ( json_encode ( array_values ( $ tables ) ) );
58+ WP_CLI ::line ( json_encode ( $ tables ) );
5359 } else {
5460 foreach ( $ tables as $ table ) {
5561 WP_CLI ::line ( $ table );
You can’t perform that action at this time.
0 commit comments