File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Console \Commands ;
4+
5+ use Illuminate \Console \Command ;
6+ use Illuminate \Support \Facades \Artisan ;
7+
8+ class SystemMaintenance extends Command
9+ {
10+ /**
11+ * The name and signature of the console command.
12+ *
13+ * @var string
14+ */
15+ protected $ signature = 'app:system-maintenance ' ;
16+
17+ /**
18+ * The console command description.
19+ *
20+ * @var string
21+ */
22+ protected $ description = 'Functions to keep Speedtest Tracker nice and healthy. ' ;
23+
24+ /**
25+ * Execute the console command.
26+ */
27+ public function handle ()
28+ {
29+ $ this ->refreshCache ();
30+
31+ return Command::SUCCESS ;
32+ }
33+
34+ /**
35+ * Clear and refresh the cache.
36+ */
37+ protected function refreshCache (): void
38+ {
39+ Artisan::call ('optimize:clear ' );
40+
41+ Artisan::call ('optimize ' );
42+ }
43+ }
Original file line number Diff line number Diff line change 33namespace App \Console ;
44
55use App \Console \Commands \RunOoklaSpeedtest ;
6+ use App \Console \Commands \SystemMaintenance ;
67use App \Console \Commands \VersionChecker ;
78use App \Settings \GeneralSettings ;
89use Cron \CronExpression ;
@@ -18,6 +19,13 @@ protected function schedule(Schedule $schedule): void
1819 {
1920 $ settings = new GeneralSettings ();
2021
22+ /**
23+ * Perform system maintenance weekly on Sunday morning,
24+ * start off the week nice and fresh.
25+ */
26+ $ schedule ->command (SystemMaintenance::class)->weeklyOn (0 )
27+ ->timezone ($ settings ->timezone ?? 'UTC ' );
28+
2129 /**
2230 * Checked for new versions weekly on Thursday because
2331 * I usually do releases on Thursday or Friday.
You can’t perform that action at this time.
0 commit comments