diff --git a/administrator/components/com_finder/src/Controller/IndexController.php b/administrator/components/com_finder/src/Controller/IndexController.php index 042253c2f23bc..918f7b08b21ec 100644 --- a/administrator/components/com_finder/src/Controller/IndexController.php +++ b/administrator/components/com_finder/src/Controller/IndexController.php @@ -79,7 +79,9 @@ public function purge() $this->checkToken(); // Remove the script time limit. - @set_time_limit(0); + if (\function_exists('set_time_limit')) { + set_time_limit(0); + } /** @var \Joomla\Component\Finder\Administrator\Model\IndexModel $model */ $model = $this->getModel('Index', 'Administrator'); diff --git a/administrator/components/com_finder/src/Controller/IndexerController.php b/administrator/components/com_finder/src/Controller/IndexerController.php index e00e30c1f04d4..77ee717310810 100644 --- a/administrator/components/com_finder/src/Controller/IndexerController.php +++ b/administrator/components/com_finder/src/Controller/IndexerController.php @@ -133,7 +133,9 @@ public function batch() ob_start(); // Remove the script time limit. - @set_time_limit(0); + if (\function_exists('set_time_limit')) { + set_time_limit(0); + } // Get the indexer state. $state = Indexer::getState(); diff --git a/libraries/src/Application/DaemonApplication.php b/libraries/src/Application/DaemonApplication.php index abdedf1484ca7..825ee9deceb6f 100644 --- a/libraries/src/Application/DaemonApplication.php +++ b/libraries/src/Application/DaemonApplication.php @@ -130,7 +130,9 @@ public function __construct(Cli $input = null, Registry $config = null, Dispatch parent::__construct($input, $config, null, null, $dispatcher); // Set some system limits. - @set_time_limit($this->config->get('max_execution_time', 0)); + if (\function_exists('set_time_limit')) { + set_time_limit($this->config->get('max_execution_time', 0)); + } if ($this->config->get('max_memory_limit') !== null) { ini_set('memory_limit', $this->config->get('max_memory_limit', '256M')); diff --git a/libraries/src/Console/FinderIndexCommand.php b/libraries/src/Console/FinderIndexCommand.php index 78cd077ac762c..10ce114c81bb0 100644 --- a/libraries/src/Console/FinderIndexCommand.php +++ b/libraries/src/Console/FinderIndexCommand.php @@ -366,7 +366,9 @@ private function index() $app->triggerEvent('onStartIndex'); // Remove the script time limit. - @set_time_limit(0); + if (\function_exists('set_time_limit')) { + set_time_limit(0); + } // Get the indexer state. $state = Indexer::getState(); diff --git a/libraries/src/Filesystem/File.php b/libraries/src/Filesystem/File.php index 435ead9ba9c3a..d199d2e5cc3d6 100644 --- a/libraries/src/Filesystem/File.php +++ b/libraries/src/Filesystem/File.php @@ -407,7 +407,9 @@ public static function move($src, $dest, $path = '', $useStreams = false) */ public static function write($file, $buffer, $useStreams = false) { - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } // If the destination directory doesn't exist we need to create it if (!file_exists(\dirname($file))) { @@ -466,7 +468,9 @@ public static function write($file, $buffer, $useStreams = false) */ public static function append($file, $buffer, $useStreams = false) { - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } // If the file doesn't exist, just write instead of append if (!file_exists($file)) { diff --git a/libraries/src/Filesystem/Folder.php b/libraries/src/Filesystem/Folder.php index cef115745c236..1d2da094f9cad 100644 --- a/libraries/src/Filesystem/Folder.php +++ b/libraries/src/Filesystem/Folder.php @@ -46,7 +46,9 @@ abstract class Folder */ public static function copy($src, $dest, $path = '', $force = false, $useStreams = false) { - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } $FTPOptions = ClientHelper::getCredentials('ftp'); @@ -285,7 +287,9 @@ public static function create($path = '', $mode = 0755) */ public static function delete($path) { - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } // Sanity check if (!$path) { @@ -566,7 +570,9 @@ public static function folders( */ protected static function _items($path, $filter, $recurse, $full, $exclude, $excludeFilterString, $findFiles) { - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } $arr = []; diff --git a/libraries/src/Installer/InstallerHelper.php b/libraries/src/Installer/InstallerHelper.php index 84af3cf811515..be0348be2f827 100644 --- a/libraries/src/Installer/InstallerHelper.php +++ b/libraries/src/Installer/InstallerHelper.php @@ -128,7 +128,9 @@ public static function downloadPackage($url, $target = false) ini_set('track_errors', $track_errors); // Bump the max execution time because not using built in php zip libs are slow - @set_time_limit(ini_get('max_execution_time')); + if (\function_exists('set_time_limit')) { + set_time_limit(ini_get('max_execution_time')); + } // Return the name of the downloaded package return basename($target);