Add support for overriding the Time and Memory Limits (#8389)

This is similar to what exists for the LDAP Import, and adds support for
setting th  Import and Report max execution time and memory limits

Co-authored-by: snipe <snipe@snipe.net>
This commit is contained in:
Tom Misilo 2021-03-24 13:40:43 -05:00 committed by GitHub
parent 0b41f9182a
commit 7557879d4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -5,8 +5,8 @@ use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
ini_set('max_execution_time', env('IMPORT_TIME_LIM', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('IMPORT_MEM_LIM', '500M'));
/**
* Class ObjectImportCommand

View file

@ -403,7 +403,9 @@ class ReportsController extends Controller
*/
public function postCustom(Request $request)
{
ini_set('max_execution_time', 12000);
ini_set('max_execution_time', env('REPORT_TIME_LIM', 12000)); //12000 seconds = 200 minutes
$this->authorize('reports.view');

View file

@ -32,8 +32,8 @@ class ItemImportRequest extends FormRequest
public function import(Import $import)
{
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
ini_set('memory_limit', '500M');
ini_set('max_execution_time', env('IMPORT_TIME_LIM', 600)); //600 seconds = 10 minutes
ini_set('memory_limit', env('IMPORT_MEM_LIM', '500M'));
$filename = config('app.private_uploads') . '/imports/' . $import->file_path;
$import->import_type = $this->input('import-type');
$class = title_case($import->import_type);