2015-11-21 17:22:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Console\Commands;
|
|
|
|
|
2023-05-17 16:56:55 +00:00
|
|
|
use BookStack\Activity\Models\View;
|
2015-11-21 17:22:14 +00:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
2023-05-24 12:21:46 +00:00
|
|
|
class ClearViewsCommand extends Command
|
2015-11-21 17:22:14 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2017-02-26 09:14:18 +00:00
|
|
|
protected $signature = 'bookstack:clear-views';
|
2015-11-21 17:22:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2020-04-09 15:58:40 +00:00
|
|
|
protected $description = 'Clear all view-counts for all entities';
|
2015-11-21 17:22:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
2023-05-24 11:59:50 +00:00
|
|
|
public function handle(): int
|
2015-11-21 17:22:14 +00:00
|
|
|
{
|
2023-05-24 11:59:50 +00:00
|
|
|
View::query()->truncate();
|
2017-02-26 09:14:18 +00:00
|
|
|
$this->comment('Views cleared');
|
2023-05-24 11:59:50 +00:00
|
|
|
return 0;
|
2015-11-21 17:22:14 +00:00
|
|
|
}
|
|
|
|
}
|