Merge pull request #3802 from Ko-/master
Check that set_time_limit is not disabled before calling it
This commit is contained in:
commit
57c1be8633
|
@ -24,7 +24,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// no php execution timeout for webdav
|
// no php execution timeout for webdav
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
|
|
||||||
// Turn off output buffering to prevent memory problems
|
// Turn off output buffering to prevent memory problems
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// no php execution timeout for webdav
|
// no php execution timeout for webdav
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
|
|
||||||
// Turn off output buffering to prevent memory problems
|
// Turn off output buffering to prevent memory problems
|
||||||
|
|
|
@ -48,7 +48,9 @@ try {
|
||||||
require_once __DIR__ . '/lib/base.php';
|
require_once __DIR__ . '/lib/base.php';
|
||||||
|
|
||||||
// set to run indefinitely if needed
|
// set to run indefinitely if needed
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!OC::$CLI) {
|
if (!OC::$CLI) {
|
||||||
echo "This script can be run from the command line only" . PHP_EOL;
|
echo "This script can be run from the command line only" . PHP_EOL;
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
*/
|
*/
|
||||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||||
|
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
|
|
||||||
require_once '../../lib/base.php';
|
require_once '../../lib/base.php';
|
||||||
|
|
||||||
$l = \OC::$server->getL10N('core');
|
$l = \OC::$server->getL10N('core');
|
||||||
|
|
|
@ -160,6 +160,14 @@
|
||||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(!data.isSettimelimitAvailable) {
|
||||||
|
messages.push({
|
||||||
|
msg: t(
|
||||||
|
'core',
|
||||||
|
'The PHP function "set_time_limit" is not available. This could result in scripts being halted mid-execution, breaking your installation. We strongly recommend enabling this function.'),
|
||||||
|
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
messages.push({
|
messages.push({
|
||||||
msg: t('core', 'Error occurred while checking server setup'),
|
msg: t('core', 'Error occurred while checking server setup'),
|
||||||
|
|
4
cron.php
4
cron.php
|
@ -84,7 +84,9 @@ try {
|
||||||
|
|
||||||
if (OC::$CLI) {
|
if (OC::$CLI) {
|
||||||
// set to run indefinitely if needed
|
// set to run indefinitely if needed
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// the cron job must be executed with the right user
|
// the cron job must be executed with the right user
|
||||||
if (!function_exists('posix_getuid')) {
|
if (!function_exists('posix_getuid')) {
|
||||||
|
|
|
@ -616,7 +616,9 @@ class OC {
|
||||||
//Let´s try to overwrite some defaults anyway
|
//Let´s try to overwrite some defaults anyway
|
||||||
|
|
||||||
//try to set the maximum execution time to 60min
|
//try to set the maximum execution time to 60min
|
||||||
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
@set_time_limit(3600);
|
@set_time_limit(3600);
|
||||||
|
}
|
||||||
@ini_set('max_execution_time', 3600);
|
@ini_set('max_execution_time', 3600);
|
||||||
@ini_set('max_input_time', 3600);
|
@ini_set('max_input_time', 3600);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,9 @@ class OC_Files {
|
||||||
|
|
||||||
$streamer->sendHeaders($name);
|
$streamer->sendHeaders($name);
|
||||||
$executionTime = intval(OC::$server->getIniWrapper()->getNumeric('max_execution_time'));
|
$executionTime = intval(OC::$server->getIniWrapper()->getNumeric('max_execution_time'));
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
ignore_user_abort(true);
|
ignore_user_abort(true);
|
||||||
if ($getType === self::ZIP_FILES) {
|
if ($getType === self::ZIP_FILES) {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
|
|
@ -285,6 +285,20 @@ class CheckSetupController extends Controller {
|
||||||
return !(!extension_loaded('memcached') && extension_loaded('memcache'));
|
return !(!extension_loaded('memcached') && extension_loaded('memcache'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if set_time_limit is not disabled.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function isSettimelimitAvailable() {
|
||||||
|
if (function_exists('set_time_limit')
|
||||||
|
&& strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
|
@ -411,6 +425,7 @@ Raw output
|
||||||
'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
|
'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
|
||||||
'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(),
|
'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(),
|
||||||
'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'),
|
'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'),
|
||||||
|
'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,9 @@ class EncryptionController extends Controller {
|
||||||
*/
|
*/
|
||||||
public function startMigration() {
|
public function startMigration() {
|
||||||
// allow as long execution on the web server as possible
|
// allow as long execution on the web server as possible
|
||||||
set_time_limit(0);
|
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
|
@set_time_limit(0);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue