]> source.dussan.org Git - nextcloud-server.git/commitdiff
Prevent PHP request to get killed when using fclose callback (#26775) 4491/head
authorVincent Petry <pvince81@owncloud.com>
Fri, 13 Jan 2017 11:55:08 +0000 (12:55 +0100)
committerRobin Appelman <robin@icewind.nl>
Tue, 25 Apr 2017 12:11:38 +0000 (14:11 +0200)
* Prevent PHP request to get killed when using fclose callback

* Add ignore_user_abort everywhere where the time limit is set to 0

Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/dav/appinfo/v1/webdav.php
apps/dav/appinfo/v2/remote.php
lib/private/Files/View.php
lib/private/legacy/files.php

index f04bf40633459d58ca604decfa1f845d31925a1f..5ad11ceada86cef0a102b16014c0700bf975c2c7 100644 (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();
index ab05e376503d9418e1785b882559819b80e98238..b4a6578a41a8f94efac93eea7538cc9854bf1be1 100644 (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();
index 6facc7b9462caa771d18b395503fef7b0fc0956b..274ebed05c3d69fd8e5b241b989a13fd167ff6fd 100644 (file)
@@ -1149,6 +1149,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);
index b6c6857a1bfaae70cb9cfefc5c34b90faa2aff97..8c9adad0d4986322bad840034e7d1168a4d3da86 100644 (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;