Skip to content

Commit 2e77230

Browse files
committed
fix(envlite): abort Phase 5 when ZipArchive extraction fails
ZipArchive::extractTo returns false on a partial or failed extraction (permissions, full disk, malformed entries). The previous code ignored that and unconditionally recorded the plugin directory as envlite-owned; on the next run the db.copy short-circuit would then skip re-downloading and leave a half-extracted, unverified SQLite plugin tree in place. Treat a non-true return as fatal so Phase 5 surfaces the failure instead of pinning broken state into the manifest.
1 parent 00c740e commit 2e77230

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tools/local-env/envlite.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,16 @@ function envlite_phase5_install(string $repoRoot, bool $force): void {
536536
if ($zip->open($tmpZip) !== true) {
537537
throw new \RuntimeException("ZipArchive::open failed: $tmpZip");
538538
}
539-
$zip->extractTo("$repoRoot/src/wp-content/plugins/");
539+
// extractTo returns false on partial/failed extraction (permissions,
540+
// disk full, malformed entries). Recording the directory as
541+
// envlite-owned in that case would let a later run satisfy the
542+
// db.copy short-circuit and skip re-downloading, leaving a
543+
// half-extracted plugin tree in place.
544+
$extracted = $zip->extractTo("$repoRoot/src/wp-content/plugins/");
540545
$zip->close();
546+
if ($extracted !== true) {
547+
throw new \RuntimeException("ZipArchive::extractTo failed for $tmpZip");
548+
}
541549
} finally {
542550
@unlink($tmpZip);
543551
}

0 commit comments

Comments
 (0)