mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #4488 from turbo124/v5-develop
Add additional SystemHealth checks
This commit is contained in:
commit
666966c8bd
@ -101,8 +101,6 @@ class Handler extends ExceptionHandler
|
||||
|
||||
private function validException($exception)
|
||||
{
|
||||
info("the exception is ");
|
||||
info($exception->getMessage());
|
||||
|
||||
if(strpos($exception->getMessage(), 'file_put_contents') === TRUE)
|
||||
return FALSE;
|
||||
@ -110,6 +108,10 @@ class Handler extends ExceptionHandler
|
||||
if(strpos($exception->getMessage(), 'Permission denied') === TRUE)
|
||||
return FALSE;
|
||||
|
||||
if(strpos($exception->getMessage(), 'flock()') === TRUE)
|
||||
return FALSE;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ class EmailController extends BaseController
|
||||
}
|
||||
});
|
||||
|
||||
$entity_obj->service()->markSent()->save();
|
||||
$entity_obj = $entity_obj->service()->markSent()->save();
|
||||
|
||||
$entity_obj->last_sent_date = now();
|
||||
$entity_obj->save();
|
||||
@ -172,8 +172,6 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = RecurringInvoiceTransformer::class;
|
||||
}
|
||||
|
||||
$entity_obj->service()->markSent()->save();
|
||||
|
||||
return $this->itemResponse($entity_obj);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class ImportController extends Controller
|
||||
$hash = Str::random(32);
|
||||
|
||||
//store the csv in cache with an expiry of 10 minutes
|
||||
Cache::put($hash, base64_encode(file_get_contents($request->file('file')->getPathname())), 10);
|
||||
Cache::put($hash, base64_encode(file_get_contents($request->file('file')->getPathname())), 60);
|
||||
|
||||
//parse CSV
|
||||
$csv_array = $this->getCsvData(file_get_contents($request->file('file')->getPathname()));
|
||||
|
@ -20,11 +20,14 @@ use App\Models\InvoiceInvitation;
|
||||
use App\Services\PdfMaker\Design;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
|
||||
class PreviewController extends BaseController
|
||||
{
|
||||
@ -96,15 +99,16 @@ class PreviewController extends BaseController
|
||||
|
||||
$entity_obj->load('client');
|
||||
|
||||
App::setLocale($entity_obj->client->primary_contact()->preferredLocale());
|
||||
App::forgetInstance('translator');
|
||||
Lang::replace(Ninja::transformTranslations($entity_obj->client->getMergedSettings()));
|
||||
|
||||
$html = new HtmlEngine($entity_obj->invitations()->first());
|
||||
|
||||
$design_namespace = 'App\Services\PdfMaker\Designs\\'.request()->design['name'];
|
||||
|
||||
$design_class = new $design_namespace();
|
||||
|
||||
// $designer = new Designer($entity_obj, $design_object, $entity_obj->client->getSetting('pdf_variables'), lcfirst($entity));
|
||||
// $html = $this->generateEntityHtml($designer, $entity_obj);
|
||||
|
||||
$state = [
|
||||
'template' => $design_class->elements([
|
||||
'client' => $entity_obj->client,
|
||||
@ -141,6 +145,10 @@ class PreviewController extends BaseController
|
||||
|
||||
private function blankEntity()
|
||||
{
|
||||
|
||||
App::forgetInstance('translator');
|
||||
Lang::replace(Ninja::transformTranslations(auth()->user()->company()->settings));
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$client = Client::factory()->create([
|
||||
|
@ -78,9 +78,27 @@ class SystemHealth
|
||||
'node_status' => self::checkNode(),
|
||||
'cache_enabled' => self::checkConfigCache(),
|
||||
'phantom_enabled' => (bool) config('ninja.phantomjs_pdf_generation'),
|
||||
'exec' => (bool) self::checkExecWorks(),
|
||||
'open_basedir' => (bool) self::checkOpenBaseDir(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function checkOpenBaseDir()
|
||||
{
|
||||
if(strlen(ini_get('open_basedir') == 0))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function checkExecWorks()
|
||||
{
|
||||
if(function_exists('exec'))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function checkConfigCache()
|
||||
{
|
||||
if (env('APP_URL')) {
|
||||
|
Loading…
Reference in New Issue
Block a user