mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update console kernel, add import upload gc
This commit is contained in:
parent
b47e8f8e3e
commit
afe6948da8
2 changed files with 43 additions and 0 deletions
42
app/Console/Commands/ImportUploadCleanStorage.php
Normal file
42
app/Console/Commands/ImportUploadCleanStorage.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\ImportPost;
|
||||
use Storage;
|
||||
use App\Services\ImportService;
|
||||
use App\User;
|
||||
|
||||
class ImportUploadCleanStorage extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:import-upload-clean-storage';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$dirs = Storage::allDirectories('imports');
|
||||
|
||||
foreach($dirs as $dir) {
|
||||
$uid = last(explode('/', $dir));
|
||||
$skip = User::whereNull('status')->find($uid);
|
||||
if(!$skip) {
|
||||
Storage::deleteDirectory($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ class Kernel extends ConsoleKernel
|
|||
$schedule->command('app:transform-imports')->everyFourMinutes();
|
||||
$schedule->command('app:import-upload-garbage-collection')->hourlyAt(51);
|
||||
$schedule->command('app:import-remove-deleted-accounts')->hourlyAt(37);
|
||||
$schedule->command('app:import-upload-clean-storage')->twiceDailyAt(1, 13, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue