Fix backup import for Jetpack, Local, Wpress and Studio formats - #2422
Conversation
📊 Performance Test ResultsComparing 3e1e771 vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
fredrikekelund
left a comment
There was a problem hiding this comment.
Good catch! This works great 👍
| ); | ||
| } | ||
|
|
||
| const phpVersion = parsedWpCliArgs[ 'php-version' ] as string | undefined; |
There was a problem hiding this comment.
const parsedWpCliArgs = yargsParser( wpCliArgv, {
string: [ 'php-version' ],
} );
if ( parsedWpCliArgs._[ 0 ] === 'shell' ) {
throw new LoggerError(
__(
'Studio CLI does not support the WP-CLI `shell` command. Consider adding your code to a file and using the `eval` command.'
)
);
}
const phpVersion = parsedWpCliArgs[ 'php-version' ];Unfortunately, yargs-parser doesn't properly type parsedWpCliArgs[ 'php-version' ] if we do this, so I still prefer your solution.
I wanted to mention the possibility of configuring yargs-parser, though, since it fixes the underlying issue of --php-version being parsed by yargs as a number.
katinthehatsite
left a comment
There was a problem hiding this comment.
The changes look good to me, I was able to import .wpress, Studio and Jetpack files. I got this warning with .wpress but I don't think it is related to this PR:
Warning during replacing URLs (https:\/\/mxhtestpremium3.wpcomstaging.com): Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /wordpress/wp-content/mu-plugins/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-pdo-user-defined-functions.php on line 511
I also noticed something strange with the database export for older sites where it was failing so asked on Slack: p1768898334187009/1768816016.045449-slack-C06DRMD6VPZ but again it is not related to this PR 👍
wojtekn
left a comment
There was a problem hiding this comment.
Thanks for the fix. The code change looks reasonable.
Related issues
Proposed Changes
yargs-parserconverts--php-version 8.3from string to number, causing Zod validation to fail silently. Now explicitly converts back to string.sqlite importcommand needs an absolute path/wordpress/<file>because standalone PHP-WASM mounts the site at/wordpressbut doesn't set the working directory there.Testing Instructions
Pre-merge Checklist