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
3 changes: 1 addition & 2 deletions components/Blueprints/Steps/class-importcontentstep.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ private function importWxr( Runtime $runtime, array $content_definition, Tracker
$import_process = $runtime->create_php_sub_process(
$importer_script .
<<<'PHP'
<?php

run_content_import([
'mode' => 'wxr',
'execution_context_root' => getenv('EXECUTION_CONTEXT') ? getenv('EXECUTION_CONTEXT') : null,
'source' => json_decode(getenv('DATA_SOURCE_DEFINITION'), true),
// @TODO: Support arbitrary media URLs to enable fetching assets during import.
// 'media_url' => 'https://pd.w.org/'
]);
?>
PHP
,
array(
Expand Down
17 changes: 11 additions & 6 deletions components/Blueprints/class-runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use WordPress\Blueprints\VersionStrings\WordPressVersion;
use WordPress\ByteStream\ReadStream\FileReadStream;
use WordPress\Filesystem\Filesystem;
use WordPress\Filesystem\FilesystemException;
use WordPress\Filesystem\InMemoryFilesystem;
use WordPress\Filesystem\LocalFilesystem;
use WordPress\HttpClient\ByteStream\RequestReadStream;
Expand Down Expand Up @@ -288,12 +289,16 @@ public function run(): void {
$progress->finish();
} finally {
// TODO: Optionally preserve workspace in case of error? Support resuming after error?
LocalFilesystem::create( $temp_root )->rmdir(
'/',
array(
'recursive' => true,
)
);
try {
LocalFilesystem::create( $temp_root )->rmdir(
'/',
array(
'recursive' => true,
)
);
} catch ( FilesystemException $exception ) {
// Do not fail or mask Blueprint execution because temporary cleanup failed.
}
}
}

Expand Down
Loading