Skip to content

Firefly III: a personal finances manager

Validate directory permissions with a lot of debug logs.

James Colec74c8a96b885
diff --git a/app/Console/Commands/Integrity/ValidatesFilePermissions.php b/app/Console/Commands/Integrity/ValidatesFilePermissions.php
index 324ec43752..d414a755ff 100644
--- a/app/Console/Commands/Integrity/ValidatesFilePermissions.php
+++ b/app/Console/Commands/Integrity/ValidatesFilePermissions.php
@@ -26,6 +26,7 @@ namespace FireflyIII\Console\Commands\Integrity;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
class ValidatesFilePermissions extends Command
{
@@ -36,7 +37,7 @@ class ValidatesFilePermissions extends Command
*
* @var string
*/
- protected $signature = 'integrity:file-permissions';
+ protected $signature = 'integrity:file-permissions';
/**
* The console command description.
@@ -50,26 +51,38 @@ class ValidatesFilePermissions extends Command
*/
public function handle(): int
{
+ Log::debug(sprintf('Start of %s', $this->signature));
$directories = [storage_path('upload')];
$errors = false;
/** @var string $directory */
foreach ($directories as $directory) {
+ Log::debug(sprintf('Processing directory: %s', $directory));
if (!is_dir($directory)) {
- $this->friendlyError(sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $directory));
+ $message = sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $directory);
+ Log::error($message);
+ $this->friendlyError($message);
$errors = true;
continue;
}
+ Log::debug('It is a directory!');
if (!is_writable($directory)) {
- $this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $directory));
+ $message = sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $directory);
+ $this->friendlyError($message);
+ Log::error($message);
$errors = true;
}
+ Log::debug('It is writeable!');
+ Log::debug(sprintf('Done processing %s', $directory));
}
+ Log::debug('Done with loop.');
if (false === $errors) {
+ Log::debug('No errors.');
$this->friendlyInfo('All necessary file paths seem to exist, and are writeable.');
}
+ Log::debug(sprintf('End of %s', $this->signature));
return self::SUCCESS;
}
}