Merge pull request #3157 from nextcloud/fcloseafterkill

[uc] Prevent PHP request to get killed when using fclose callback (#26775)
This commit is contained in:
Morris Jobke 2017-01-23 13:51:43 -06:00 committed by GitHub
commit 9b0c6c0eff
4 changed files with 5 additions and 0 deletions

View file

@ -25,6 +25,7 @@
// no php execution timeout for webdav
set_time_limit(0);
ignore_user_abort(true);
// Turn off output buffering to prevent memory problems
\OC_Util::obEnd();

View file

@ -21,6 +21,7 @@
*/
// no php execution timeout for webdav
set_time_limit(0);
ignore_user_abort(true);
// Turn off output buffering to prevent memory problems
\OC_Util::obEnd();

View file

@ -1146,6 +1146,8 @@ class View {
$unlockLater = false;
if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
$unlockLater = true;
// make sure our unlocking callback will still be called if connection is aborted
ignore_user_abort(true);
$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
if (in_array('write', $hooks)) {
$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);

View file

@ -148,6 +148,7 @@ class OC_Files {
$streamer->sendHeaders($name);
$executionTime = intval(OC::$server->getIniWrapper()->getNumeric('max_execution_time'));
set_time_limit(0);
ignore_user_abort(true);
if ($getType === self::ZIP_FILES) {
foreach ($files as $file) {
$file = $dir . '/' . $file;