diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-30 22:05:52 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-30 22:05:52 +0200 |
commit | b3834b49c3a98e5b7adbb64983f489f0d992c83c (patch) | |
tree | b243540a5d453dd2ed960230ffd7b17e12c518b2 /apps | |
parent | 6d94b393bf501ead44281cd4c2ce2483e18ed47f (diff) | |
download | nextcloud-server-b3834b49c3a98e5b7adbb64983f489f0d992c83c.tar.gz nextcloud-server-b3834b49c3a98e5b7adbb64983f489f0d992c83c.zip |
prevent files_versions from calling file proxy which calls files_encryption and do unnecessary load and file operations
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/versions.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 5fdbef27743..4beb9e0fe5c 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -113,8 +113,16 @@ class Storage { mkdir($versionsFolderName.'/'.$info['dirname'], 0750, true); } + // disable proxy to prevent multiple fopen calls + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + // store a new version of a file $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename)); + + // reset proxy state + \OC_FileProxy::$enabled = $proxyStatus; + $versionsSize = self::getVersionsSize($uid); if ( $versionsSize === false || $versionsSize < 0 ) { $versionsSize = self::calculateSize($uid); @@ -195,7 +203,16 @@ class Storage { //first create a new version $version = 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename); if ( !$users_view->file_exists($version)) { + + // disable proxy to prevent multiple fopen calls + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename)); + + // reset proxy state + \OC_FileProxy::$enabled = $proxyStatus; + $versionCreated = true; } |