Skip to content

Commit 1910138

Browse files
Copilotswissspidy
andcommitted
Cache is_sqlite() result in search() to avoid repeated filesystem checks
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent ee25930 commit 1910138

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/DB_Command.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,7 @@ public function search( $args, $assoc_args ) {
16301630
$tables = Utils\wp_get_table_names( $args, $assoc_args );
16311631

16321632
$search_results = [];
1633+
$is_sqlite = $this->is_sqlite();
16331634

16341635
$start_search_time = microtime( true );
16351636

@@ -1642,7 +1643,7 @@ public function search( $args, $assoc_args ) {
16421643
if ( $stats ) {
16431644
$skipped[] = $table;
16441645
// Don't bother warning for term relationships (which is just 3 int columns) or SQLite.
1645-
} elseif ( ! preg_match( '/_term_relationships$/', $table ) && ! $this->is_sqlite() ) {
1646+
} elseif ( ! preg_match( '/_term_relationships$/', $table ) && ! $is_sqlite ) {
16461647
WP_CLI::warning( $primary_keys ? "No text columns for table '$table' - skipped." : "No primary key or text columns for table '$table' - skipped." );
16471648
}
16481649
continue;

0 commit comments

Comments
 (0)