mirror of
https://github.com/getgrav/grav.git
synced 2026-02-06 06:40:29 +01:00
Correct the set_time_limit if
This commit is contained in:
@@ -78,8 +78,11 @@ class Response
|
||||
throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available');
|
||||
}
|
||||
|
||||
// check if this function is available, if so use it to stop any timeouts
|
||||
try {
|
||||
set_time_limit(0);
|
||||
if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode') && function_exists('set_time_limit')) {
|
||||
set_time_limit(0);
|
||||
}
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
$options = array_replace_recursive(self::$defaults, $options);
|
||||
|
||||
@@ -218,8 +218,11 @@ abstract class Utils
|
||||
$file_parts = pathinfo($file);
|
||||
$filesize = filesize($file);
|
||||
|
||||
// check if this function is available, if so use it to stop any timeouts
|
||||
try {
|
||||
set_time_limit(0);
|
||||
if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode') && function_exists('set_time_limit')) {
|
||||
set_time_limit(0);
|
||||
}
|
||||
} catch (\Exception $e) {}
|
||||
|
||||
ignore_user_abort(false);
|
||||
@@ -410,6 +413,25 @@ abstract class Utils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of an array using dot notation
|
||||
*/
|
||||
public static function resolve(array $array, $path, $default = null)
|
||||
{
|
||||
$current = $array;
|
||||
$p = strtok($path, '.');
|
||||
|
||||
while ($p !== false) {
|
||||
if (!isset($current[$p])) {
|
||||
return $default;
|
||||
}
|
||||
$current = $current[$p];
|
||||
$p = strtok('.');
|
||||
}
|
||||
|
||||
return $current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a value is positive
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user