Files
newznab-tmux/app/Console/Commands/CollectStats.php
T
2026-02-11 14:02:26 +01:00

52 lines
1.4 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Models\DownloadStat;
use App\Models\GrabStat;
use App\Models\ReleaseStat;
use App\Models\RoleStat;
use App\Models\SignupStat;
use App\Models\UserActivityStat;
use Illuminate\Console\Command;
class CollectStats extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nntmux:collect-stats';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Collects and stores various statistics about the site.';
/**
* Execute the console command.
*/
public function handle(): void
{
$this->info('Collecting site stats...');
GrabStat::insertTopGrabbers();
$this->info('Top grabbers collected.');
DownloadStat::insertTopDownloads();
$this->info('Top downloads collected.');
ReleaseStat::insertRecentlyAdded();
$this->info('Recently added releases collected.');
SignupStat::insertUsersByMonth();
$this->info('New users by month collected.');
RoleStat::insertUsersByRole();
$this->info('Users by role collected.');
UserActivityStat::collectDailyStats();
$this->info('User activity daily stats collected.');
UserActivityStat::collectHourlyStats();
$this->info('User activity hourly stats collected.');
$this->info('Site stats collected.');
}
}