1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add file system checks to self checker

This commit is contained in:
David Bomba 2022-04-26 14:00:42 +10:00
parent f4bfc69a49
commit ea39f4eefc
2 changed files with 22 additions and 1 deletions

View File

@ -241,7 +241,6 @@ class Import implements ShouldQueue
$this->company->account->companies()->update(['is_large' => true]);
}
$this->company->client_registration_fields = \App\DataMapper\ClientRegistrationFields::generate();
$this->company->save();

View File

@ -81,9 +81,31 @@ class SystemHealth
'pdf_engine' => (string) self::getPdfEngine(),
'queue' => (string) config('queue.default'),
'trailing_slash' => (bool) self::checkUrlState(),
'file_permissions' => (string) self::checkFileSystem()
];
}
public static function checkFileSystem()
{
$directoryIterator = new \RecursiveDirectoryIterator(base_path(), \RecursiveDirectoryIterator::SKIP_DOTS);
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if(strpos($file->getPathname(), '.git') !== false)
continue;
//nlog($file->getPathname());
if ($file->isFile() && ! $file->isWritable()) {
return "{$file->getFileName()} is not writable";
}
}
return 'Ok';
}
public static function checkUrlState()
{
if (env('APP_URL') && substr(env('APP_URL'), -1) == '/')