Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: broaden MariaDB sandbox mode detection
MariaDB 10.11+ can output the sandbox header as /*M!999999\- enable the sandbox mode */. By checking for '999999' and 'sandbox mode' separately, we ensure compatibility across different MariaDB versions and escaping styles.
  • Loading branch information
Evgenii-Zinner committed Jan 6, 2026
commit 10e19a278cd9017930e83341acf90aed6d2a15fc
14 changes: 7 additions & 7 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public function import( $args, $assoc_args ) {
$first_line = fgets( $fp );
fclose( $fp );

if ( false !== $first_line && 0 === strpos( $first_line, '/*!999999\- enable the sandbox mode */' ) ) {
if ( false !== $first_line && strpos( $first_line, '999999' ) !== false && strpos( $first_line, 'sandbox mode' ) !== false ) {
WP_CLI::log( 'MariaDB sandbox mode directive detected. Skipping it by piping the file content.' );
$preamble = $this->get_sql_mode_query( $assoc_args ) . "\n";
if ( ! Utils\get_flag_value( $assoc_args, 'skip-optimization' ) ) {
Expand All @@ -846,16 +846,16 @@ public function import( $args, $assoc_args ) {
escapeshellarg( $postamble )
);

// Ensure we don't pass 'execute' which would conflict with STDIN.
unset( $mysql_args['execute'] );
// Ensure we don't pass 'execute' which would conflict with STDIN.
unset( $mysql_args['execute'] );

$result = self::run( $command, $mysql_args );
$result = self::run( $command, $mysql_args );

self::run( $command, $mysql_args );
self::run( $command, $mysql_args );

WP_CLI::success( sprintf( "Imported from '%s'.", $result_file ) );
WP_CLI::success( sprintf( "Imported from '%s'.", $result_file ) );

return;
return;
}

$query = Utils\get_flag_value( $assoc_args, 'skip-optimization' )
Expand Down
Loading