瀏覽代碼

Update scheduler, fix S3 media garbage collection not being executed when cloud storage is enabled via dashboard without .env/config being enabled

Daniel Supernault 2 年之前
父節點
當前提交
adb070f178
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      app/Console/Commands/MediaS3GarbageCollector.php
  2. 1 1
      app/Console/Kernel.php

+ 1 - 1
app/Console/Commands/MediaS3GarbageCollector.php

@@ -45,7 +45,7 @@ class MediaS3GarbageCollector extends Command
     */
     public function handle()
     {
-        $enabled = config('pixelfed.cloud_storage');
+        $enabled = in_array(config_cache('pixelfed.cloud_storage'), ['1', true, 'true']);
         if(!$enabled) {
             $this->error('Cloud storage not enabled. Exiting...');
             return;

+ 1 - 1
app/Console/Kernel.php

@@ -33,7 +33,7 @@ class Kernel extends ConsoleKernel
         $schedule->command('gc:passwordreset')->dailyAt('09:41');
         $schedule->command('gc:sessions')->twiceDaily(13, 23);
 
-        if(config('pixelfed.cloud_storage') && config('media.delete_local_after_cloud')) {
+        if(in_array(config_cache('pixelfed.cloud_storage'), ['1', true, 'true']) && config('media.delete_local_after_cloud')) {
             $schedule->command('media:s3gc')->hourlyAt(15);
         }
     }