Skip to content

Commit

Permalink
Set max_execution_time=3600 and memory_limit=1073741824
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas K. Dionysopoulos committed Jun 7, 2022
1 parent 2d40c7a commit 1e9b803
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions administrator/components/com_joomlaupdate/extract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1942,8 +1942,44 @@ function getConfiguration(): ?array
$configuration = getConfiguration();
$enabled = !empty($configuration);

/**
* Sets the PHP timeout to 3600 seconds
*
* @return void
* @since __DEPLOY_VERSION__
*/
function setLongTimeout()
{
if (!function_exists('ini_set'))
{
return;
}

ini_set('max_execution_time', 3600);
}

/**
* Sets the memory limit to 1GiB
*
* @return void
* @since __DEPLOY_VERSION__
*/
function setHugeMemoryLimit()
{
if (!function_exists('ini_set'))
{
return;
}

ini_set('memory_limit', 1073741824);
}

if ($enabled)
{
// Try to set a very large memory and timeout limit
setLongTimeout();
setHugeMemoryLimit();

$sourcePath = $configuration['setup.sourcepath'] ?? '';
$sourceFile = $configuration['setup.sourcefile'] ?? '';
$destDir = ($configuration['setup.destdir'] ?? null) ?: __DIR__;
Expand Down

0 comments on commit 1e9b803

Please sign in to comment.