Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Application/DaemonApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Console/FinderIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions libraries/src/Filesystem/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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)) {
Expand Down
12 changes: 9 additions & 3 deletions libraries/src/Filesystem/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 = [];

Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Installer/InstallerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down