- Adds --force command to the update-url run so that it's actually ran
during a restore. Option recently added on BookStack side to support.
- Updates env handling so that the old env contents are actually used as
part of the merge. Updated existing test to cover.
Fixes #7, Fixes #8
$currentEnvDbLines = array_values(array_filter(explode("\n", $currentEnvContents), function (string $line) {
return str_starts_with($line, 'DB_');
}));
- $oldEnvLines = array_values(array_filter(explode("\n", $currentEnvContents), function (string $line) {
+ $oldEnvLines = array_values(array_filter(explode("\n", $envContents), function (string $line) {
return !str_starts_with($line, 'DB_');
}));
$envContents = implode("\n", [
$this->assertStringEqualsFile('/var/www/bookstack-restore/public/uploads/test.txt', 'hello-public-uploads');
$this->assertStringEqualsFile('/var/www/bookstack-restore/storage/uploads/test.txt', 'hello-storage-uploads');
$this->assertStringEqualsFile('/var/www/bookstack-restore/themes/test.txt', 'hello-themes');
+ $env = file_get_contents('/var/www/bookstack-restore/.env');
+ $this->assertStringContainsString('APP_KEY=abc123', $env);
+ $this->assertStringContainsString('APP_URL=https://example.com', $env);
$mysql->query("DROP TABLE zz_testing;");
exec('rm -rf /var/www/bookstack-restore');