diff options
| author | 2025-03-22 23:17:52 +0100 | |
|---|---|---|
| committer | 2025-03-22 23:17:52 +0100 | |
| commit | 64bbb42553c925ebf7177945d048c18675188584 (patch) | |
| tree | e9f11e54b44512628304bcd83a1f6f418529099f /cli/db-restore.php | |
| parent | 72ad6e528cc7d65d4d4f401a705cd9e2e6183c1a (diff) | |
Fix CLI flag parsing (#7430)
* Fix CLI flag parsing
fix https://github.com/FreshRSS/FreshRSS/issues/7428
* Fix other places
* Forgotten debugging
Diffstat (limited to 'cli/db-restore.php')
| -rwxr-xr-x | cli/db-restore.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cli/db-restore.php b/cli/db-restore.php index 32f43708f..8e4ffcc12 100755 --- a/cli/db-restore.php +++ b/cli/db-restore.php @@ -6,8 +6,8 @@ require(__DIR__ . '/_cli.php'); performRequirementCheck(FreshRSS_Context::systemConf()->db['type'] ?? ''); $cliOptions = new class extends CliOptionsParser { - public string $deleteBackup; - public string $forceOverwrite; + public bool $deleteBackup; + public bool $forceOverwrite; public function __construct() { $this->addOption('deleteBackup', (new CliOption('delete-backup'))->withValueNone()); @@ -49,10 +49,9 @@ foreach (listUsers() as $username) { echo 'FreshRSS restore database from SQLite for user “', $username, "”…\n"; $databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); - $clearFirst = isset($cliOptions->forceOverwrite); - $ok &= $databaseDAO->dbCopy($filename, FreshRSS_DatabaseDAO::SQLITE_IMPORT, $clearFirst); + $ok &= $databaseDAO->dbCopy($filename, FreshRSS_DatabaseDAO::SQLITE_IMPORT, clearFirst: $cliOptions->forceOverwrite); if ($ok) { - if (isset($cliOptions->deleteBackup)) { + if ($cliOptions->deleteBackup) { unlink($filename); } } else { |
