Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion apps/studio/src/ipc-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { setSentryWpcomUserIdMain } from 'src/lib/main-sentry-utils';
import * as oauthClient from 'src/lib/oauth';
import { getAiInstructionsPath } from 'src/lib/server-files-paths';
import { shellOpenExternalWrapper } from 'src/lib/shell-open-external-wrapper';
import { keepSqliteIntegrationUpdated } from 'src/lib/sqlite-versions';
import { installSqliteIntegration, keepSqliteIntegrationUpdated } from 'src/lib/sqlite-versions';
import * as windowsHelpers from 'src/lib/windows-helpers';
import { setupWordPressFilesOnly } from 'src/lib/wordpress-setup';
import { getLogsFilePath, writeLogToFile, type LogLevel } from 'src/logging';
Expand Down Expand Up @@ -364,6 +364,10 @@ export async function importSite(
await setupWordPressFilesOnly( site.details.path );
}

if ( ! ( await site.hasSQLitePlugin() ) ) {
await installSqliteIntegration( site.details.path );
}

const onEvent = ( data: ImportExportEventData ) => {
const parentWindow = BrowserWindow.fromWebContents( event.sender );
sendIpcEventToRendererWithWindow( parentWindow, 'on-import', data, id );
Expand Down
3 changes: 3 additions & 0 deletions apps/studio/src/lib/sqlite-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ export const getSqliteVersionFromInstallation = ( sqliteMuPluginPath: string ) =

export const keepSqliteIntegrationUpdated = ( sitePath: string ) =>
provider.keepSqliteIntegrationUpdated( sitePath );

export const installSqliteIntegration = ( sitePath: string ) =>
provider.installSqliteIntegration( sitePath );
19 changes: 11 additions & 8 deletions apps/studio/src/stores/sync/sync-operations-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,14 +806,17 @@ const pollPullBackupThunk = createTypedAsyncThunk(
);

await getIpcApi().stopServer( selectedSiteId );
await getIpcApi().importSite( {
id: selectedSiteId,
backupFile: {
path: filePath,
type: 'application/tar+gzip',
},
} );
await getIpcApi().startServer( selectedSiteId );
try {
await getIpcApi().importSite( {
id: selectedSiteId,
backupFile: {
path: filePath,
type: 'application/tar+gzip',
},
} );
} finally {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking - does it make sense to add a comment explaining why we didn’t add a catch here?

await getIpcApi().startServer( selectedSiteId );
}

await getIpcApi().removeSyncBackup( remoteSiteId );

Expand Down
6 changes: 6 additions & 0 deletions apps/studio/src/tests/ipc-handlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ vi.mock( 'src/lib/wordpress-setup', () => ( {
} ) );
vi.mock( 'src/main-window' );
vi.mock( 'src/lib/import-export/import/import-manager' );
vi.mock( 'src/lib/sqlite-versions', () => ( {
keepSqliteIntegrationUpdated: vi.fn().mockResolvedValue( false ),
installSqliteIntegration: vi.fn().mockResolvedValue( undefined ),
} ) );
vi.mock( import( 'src/lib/bump-stats' ), async ( importOriginal ) => {
const actual = await importOriginal();
return {
Expand Down Expand Up @@ -195,6 +199,7 @@ describe( 'importSite', () => {
start: vi.fn(),
stop: vi.fn(),
updateSiteDetails: vi.fn(),
hasSQLitePlugin: vi.fn().mockResolvedValue( true ),
executeWpCliCommand: vi
.fn()
.mockResolvedValue( { stdout: 'New Site Title', stderr: '', exitCode: 0 } ),
Expand Down Expand Up @@ -244,6 +249,7 @@ describe( 'importSite', () => {
start: vi.fn(),
stop: vi.fn(),
updateSiteDetails: vi.fn(),
hasSQLitePlugin: vi.fn().mockResolvedValue( true ),
executeWpCliCommand: vi
.fn()
.mockResolvedValue( { stdout: 'New Site Title', stderr: '', exitCode: 0 } ),
Expand Down
Loading