| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace BookStack\Console\Commands; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-16 17:49:37 +08:00
										 |  |  | use BookStack\Actions\View; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | use Illuminate\Console\Command; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  | class ClearViews extends Command | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The name and signature of the console command. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |     protected $signature = 'bookstack:clear-views'; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The console command description. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2020-04-09 23:58:40 +08:00
										 |  |  |     protected $description = 'Clear all view-counts for all entities'; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Create a new command instance. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __construct() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         parent::__construct(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Execute the console command. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return mixed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function handle() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-05-16 17:49:37 +08:00
										 |  |  |         View::clearAll(); | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |         $this->comment('Views cleared'); | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } |