This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/app/Console/Command/PurgeInactiveUsersCommand.php
2016-12-18 23:00:24 +01:00

39 lines
810 B
PHP

<?php
/**
* Holds the inactive user purger.
* @package Sakura
*/
namespace Sakura\Console\Command;
use CLIFramework\Command;
use Sakura\DB;
/**
* Purges users that have been inactive for 30 days or more.
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class PurgeInactiveUsersCommand extends Command
{
/**
* A quick description of this command.
* @return string.
*/
public function brief(): string
{
return "Purges users that have been inactive for 30 days or more.";
}
/**
* Does the repository installing.
*/
public function execute(): void
{
DB::table('users')
->where('user_activated', 0)
->where('user_last_online', '<', time() - (30 * 24 * 60 * 60))
->delete();
}
}