Migrate Laysense to upstream LaySite 1.4.3 with external site data

This commit is contained in:
2026-11-27 17:47:31 +08:00
parent b8eb9b35eb
commit 1d2cb2ed1e
277 changed files with 9049 additions and 3222 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
require dirname(__DIR__) . '/vendor/autoload.php';
use App\Content\SiteBackup;
[$command, $path, $confirm] = array_pad(array_slice($argv, 1), 3, null);
if (!is_string($path) || ($command !== 'export' && ($command !== 'import' || $confirm !== '--replace'))) {
fwrite(STDERR, "Usage: php bin/backup.php export snapshot.tar | import snapshot.tar --replace\n");
exit(2);
}
$path = str_starts_with($path, '/') ? $path : getcwd() . '/' . $path;
try {
if ($command === 'export') {
SiteBackup::export($path);
} else {
SiteBackup::import($path);
}
echo ($command === 'export' ? '备份已导出。' : '站点已还原。') . PHP_EOL;
} catch (Throwable $error) {
fwrite(STDERR, $error->getMessage() . PHP_EOL);
exit(1);
}