mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2025-12-26 23:17:47 -05:00
1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary. 2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`.
29 lines
712 B
PHP
Executable File
29 lines
712 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/_cli.php';
|
|
|
|
performRequirementCheck(FreshRSS_Context::systemConf()->db['type'] ?? '');
|
|
|
|
$cliOptions = new class extends CliOptionsParser {
|
|
public string $user;
|
|
|
|
public function __construct() {
|
|
$this->addRequiredOption('user', (new CliOption('user')));
|
|
parent::__construct();
|
|
}
|
|
};
|
|
|
|
if (!empty($cliOptions->errors)) {
|
|
fail('FreshRSS error: ' . array_shift($cliOptions->errors) . "\n" . $cliOptions->usage);
|
|
}
|
|
|
|
$username = cliInitUser($cliOptions->user);
|
|
|
|
echo 'FreshRSS optimizing database for user “', $username, "”…\n";
|
|
|
|
$databaseDAO = FreshRSS_Factory::createDatabaseDAO($username);
|
|
$ok = $databaseDAO->optimize();
|
|
|
|
done($ok);
|