Fixed logs
This commit is contained in:
parent
c62d33c683
commit
ceca3d2b4a
|
@ -8,38 +8,37 @@ use Appwrite\Event\Event;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
|
|
||||||
Console::title('Maintenance V1');
|
|
||||||
|
|
||||||
Console::success(APP_NAME.' maintenance process v1 has started');
|
|
||||||
|
|
||||||
function notifyDeleteExecutionLogs(int $interval)
|
|
||||||
{
|
|
||||||
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
|
||||||
'type' => DELETE_TYPE_EXECUTIONS,
|
|
||||||
'timestamp' => time() - $interval
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function notifyDeleteAbuseLogs(int $interval)
|
|
||||||
{
|
|
||||||
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
|
||||||
'type' => DELETE_TYPE_ABUSE,
|
|
||||||
'timestamp' => time() - $interval
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function notifyDeleteAuditLogs(int $interval)
|
|
||||||
{
|
|
||||||
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
|
||||||
'type' => DELETE_TYPE_AUDIT,
|
|
||||||
'timestamp' => time() - $interval
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cli
|
$cli
|
||||||
->task('maintenance')
|
->task('maintenance')
|
||||||
->desc('Schedules maintenance tasks and publishes them to resque')
|
->desc('Schedules maintenance tasks and publishes them to resque')
|
||||||
->action(function () {
|
->action(function () {
|
||||||
|
Console::title('Maintenance V1');
|
||||||
|
Console::success(APP_NAME.' maintenance process v1 has started');
|
||||||
|
|
||||||
|
function notifyDeleteExecutionLogs(int $interval)
|
||||||
|
{
|
||||||
|
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
||||||
|
'type' => DELETE_TYPE_EXECUTIONS,
|
||||||
|
'timestamp' => time() - $interval
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyDeleteAbuseLogs(int $interval)
|
||||||
|
{
|
||||||
|
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
||||||
|
'type' => DELETE_TYPE_ABUSE,
|
||||||
|
'timestamp' => time() - $interval
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyDeleteAuditLogs(int $interval)
|
||||||
|
{
|
||||||
|
Resque::enqueue(Event::DELETE_QUEUE_NAME, Event::DELETE_CLASS_NAME, [
|
||||||
|
'type' => DELETE_TYPE_AUDIT,
|
||||||
|
'timestamp' => time() - $interval
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// # of days in seconds (1 day = 86400s)
|
// # of days in seconds (1 day = 86400s)
|
||||||
$interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400');
|
$interval = (int) App::getEnv('_APP_MAINTENANCE_INTERVAL', '86400');
|
||||||
$executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', '1209600');
|
$executionLogsRetention = (int) App::getEnv('_APP_MAINTENANCE_RETENTION_EXECUTION', '1209600');
|
||||||
|
|
Loading…
Reference in a new issue