forked from GithubBackups/vichan
maintenance.php: use ReportQueries
This commit is contained in:
parent
c82a669934
commit
67cf7a464b
@ -3,8 +3,12 @@
|
||||
* Performs maintenance tasks. Invoke this periodically if the auto_maintenance configuration option is turned off.
|
||||
*/
|
||||
|
||||
use Vichan\Data\ReportQueries;
|
||||
|
||||
require dirname(__FILE__) . '/inc/cli.php';
|
||||
|
||||
$ctx = Vichan\build_context($config);
|
||||
|
||||
echo "Clearing expired bans...\n";
|
||||
$start = microtime(true);
|
||||
$deleted_count = Bans::purge($config['require_ban_view'], $config['purge_bans']);
|
||||
@ -19,7 +23,16 @@ $deleted_count = purge_old_antispam();
|
||||
$delta = microtime(true) - $start;
|
||||
echo "Deleted $deleted_count expired antispam in $delta seconds!\n";
|
||||
$time_tot = $delta;
|
||||
$deleted_tot = $deleted_count;
|
||||
$deleted_tot += $deleted_count;
|
||||
|
||||
echo "Clearing invalid reports...\n";
|
||||
$report_queries = $ctx->get(ReportQueries::class);
|
||||
$start = microtime(true);
|
||||
$deleted_count = $report_queries->purge();
|
||||
$delta = microtime(true) - $start;
|
||||
echo "Deleted $deleted_count invalid reports in $delta seconds!\n";
|
||||
$time_tot += $delta;
|
||||
$deleted_tot += $deleted_count;
|
||||
|
||||
if ($config['cache']['enabled'] === 'fs') {
|
||||
$fs_cache = new Vichan\Data\Driver\FsCacheDriver(
|
||||
|
Loading…
x
Reference in New Issue
Block a user