diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-03-12 17:23:54 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-03-12 17:23:54 +0100 |
commit | b92be2ef1cb59f251a6d48953f4cb8d5e0eb734f (patch) | |
tree | 4dd981d0e01555cc5fcb4145431a234f4c6e7db5 /apps | |
parent | 881739cbac7b53fd99ee9467f5eb8a7a83118ceb (diff) | |
parent | 9a5c2d0080d60b74444c7f807a1e0b91e1888ef0 (diff) | |
download | nextcloud-server-b92be2ef1cb59f251a6d48953f4cb8d5e0eb734f.tar.gz nextcloud-server-b92be2ef1cb59f251a6d48953f4cb8d5e0eb734f.zip |
Merge pull request #7669 from owncloud/versions_predelete
add preDelete hook for files_versions app
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/versions.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 2bd9c15bae4..290264a90cc 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -178,6 +178,7 @@ class Storage { $versionsSize = self::calculateSize($uid); } foreach ($versions as $v) { + \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $abs_path . $v['version'])); unlink($abs_path . $v['version']); \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $abs_path . $v['version'])); $versionsSize -= $v['size']; @@ -542,8 +543,9 @@ class Storage { } foreach($toDelete as $key => $path) { - \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path)); + \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path)); $versionsFileview->unlink($path); + \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path)); unset($allVersions[$key]); // update array with the versions we keep \OCP\Util::writeLog('files_versions', "Expire: " . $path, \OCP\Util::DEBUG); } @@ -555,6 +557,7 @@ class Storage { $i = 0; while ($availableSpace < 0 && $i < $numOfVersions) { $version = current($allVersions); + \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'])); $versionsFileview->unlink($version['path'].'.v'.$version['version']); \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'])); \OCP\Util::writeLog('files_versions', 'running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'] , \OCP\Util::DEBUG); |