| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace BookStack\Console\Commands; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  | use BookStack\Activity; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | use Illuminate\Console\Command; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  | class ClearActivity 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-activity'; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The console command description. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |     protected $description = 'Clear user activity from the system'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected $activity; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Create a new command instance. | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |      * @param Activity $activity | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |     public function __construct(Activity $activity) | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |         $this->activity = $activity; | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  |         parent::__construct(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Execute the console command. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return mixed | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function handle() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2017-02-26 17:14:18 +08:00
										 |  |  |         $this->activity->newQuery()->truncate(); | 
					
						
							|  |  |  |         $this->comment('System activity cleared'); | 
					
						
							| 
									
										
										
										
											2015-11-22 01:22:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } |