mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2025-12-23 21:47:44 -05:00
* Housekeeping lib_rss.php `lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924 Moved most functions to other places. Mostly no change of code otherwise (see comments). * Extension: composer run-script phpstan-third-party
37 lines
1016 B
PHP
Executable File
37 lines
1016 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;
|
|
|
|
$cliOptions = new class extends CliOptionsParser {
|
|
public bool $quiet;
|
|
|
|
public function __construct() {
|
|
$this->addOption('quiet', (new CliOption('quiet', 'q'))->withValueNone());
|
|
parent::__construct();
|
|
}
|
|
};
|
|
|
|
if (!empty($cliOptions->errors)) {
|
|
fail('FreshRSS error: ' . array_shift($cliOptions->errors) . "\n" . $cliOptions->usage);
|
|
}
|
|
|
|
foreach (FreshRSS_user_Controller::listUsers() as $username) {
|
|
$username = cliInitUser($username);
|
|
$filename = DATA_PATH . '/users/' . $username . '/backup.sqlite';
|
|
@unlink($filename);
|
|
$verbose = !$cliOptions->quiet;
|
|
|
|
if ($verbose) {
|
|
echo 'FreshRSS backup database to SQLite for user “', $username, "”…\n";
|
|
}
|
|
|
|
$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username);
|
|
$ok &= $databaseDAO->dbCopy($filename, FreshRSS_DatabaseDAO::SQLITE_EXPORT, false, $verbose);
|
|
}
|
|
|
|
done((bool)$ok);
|