mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-03 10:57:50 -05:00
* CLI database backup and restore Can also be used to migrate from one database to another (e.g. MySQL to PostgreSQL) or to ease upgrade to a major PostgreSQL version (e.g. 15 to 16). * +x * Fix some cases * Update to docker-compose-v2 * More documentation
21 lines
577 B
PHP
Executable File
21 lines
577 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
declare(strict_types=1);
|
|
require(__DIR__ . '/_cli.php');
|
|
|
|
performRequirementCheck(FreshRSS_Context::systemConf()->db['type'] ?? '');
|
|
$ok = true;
|
|
|
|
foreach (listUsers() as $username) {
|
|
$username = cliInitUser($username);
|
|
$filename = DATA_PATH . '/users/' . $username . '/backup.sqlite';
|
|
@unlink($filename);
|
|
|
|
echo 'FreshRSS backup database to SQLite for user “', $username, "”…\n";
|
|
|
|
$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username);
|
|
$ok &= $databaseDAO->dbCopy($filename, FreshRSS_DatabaseDAO::SQLITE_EXPORT);
|
|
}
|
|
|
|
done((bool)$ok);
|