. */ namespace FireflyIII\Console\Commands\Integrity; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use Illuminate\Console\Command; class ValidatesFilePermissions extends Command { use ShowsFriendlyMessages; /** * The name and signature of the console command. * * @var string */ protected $signature = 'integrity:file-permissions'; /** * The console command description. * * @var string */ protected $description = 'Command description'; /** * Execute the console command. */ public function handle(): int { $directories = [storage_path('upload')]; $errors = false; /** @var string $directory */ foreach ($directories as $directory) { if (!is_dir($directory)) { $this->friendlyError(sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $uploadDir)); $errors = true; continue; } if (!is_writable($directory)) { $this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $uploadDir)); $errors = true; } } if(false === $errors) { $this->friendlyInfo('All necessary file paths seem to exist, and are writeable.'); } return self::SUCCESS; } }