Introduce per-video language support and multiple audio tracks (VideoAudioTrack model + migrations for language, description, title), a reusable language-select component, and a track-editor form. Bundle the self-hosted flag-icons v7.2.3 library and a NAS auto-sync command. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
71 lines
2.2 KiB
PHP
Executable File
71 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
class Kernel extends ConsoleKernel
|
|
{
|
|
/**
|
|
* Define the application's command schedule.
|
|
*/
|
|
protected function schedule(Schedule $schedule): void
|
|
{
|
|
$interval = $this->getCleanupInterval();
|
|
$schedule->command('cleanup:orphaned-videos --force')
|
|
->cron("*/{$interval} * * * *")
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
|
|
// Evict NAS stream-cache files older than 24 hours
|
|
$schedule->call(function () {
|
|
$nas = app(\App\Services\NasSyncService::class);
|
|
if ($nas->isEnabled()) {
|
|
$nas->clearNasCache(24);
|
|
}
|
|
})->daily()->name('nas-cache-evict');
|
|
|
|
// Clean up stale temp files in public/tmp older than 1 hour
|
|
$schedule->call(function () {
|
|
$tmpDir = storage_path('app/public/tmp');
|
|
if (! is_dir($tmpDir)) return;
|
|
$cutoff = time() - 3600;
|
|
foreach (glob("{$tmpDir}/*") as $file) {
|
|
if (is_file($file) && filemtime($file) < $cutoff) @unlink($file);
|
|
}
|
|
})->hourly()->name('tmp-cleanup');
|
|
|
|
// Auto-sync local files to NAS when NAS comes back online.
|
|
// Runs every 10 minutes; exits immediately when NAS is unreachable.
|
|
$schedule->command('nas:auto-sync')
|
|
->everyTenMinutes()
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
|
|
// Weekly activity digest — every Monday at 9:00 AM (Bahrain time)
|
|
$schedule->command('digest:weekly')
|
|
->weeklyOn(1, '09:00')
|
|
->withoutOverlapping()
|
|
->runInBackground();
|
|
}
|
|
|
|
/**
|
|
* Register the commands for the application.
|
|
*/
|
|
protected function commands(): void
|
|
{
|
|
$this->load(__DIR__.'/Commands');
|
|
|
|
require base_path('routes/console.php');
|
|
}
|
|
|
|
/**
|
|
* Get the interval in minutes for cleanup (from .env)
|
|
*/
|
|
protected function getCleanupInterval(): int
|
|
{
|
|
return (int) env('CLEANUP_INTERVAL_MINUTES', 30);
|
|
}
|
|
}
|