summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2014-03-11 14:17:08 +0100
committerGeorg Ehrke <developer@georgehrke.com>2014-03-11 14:17:08 +0100
commit9a5c2d0080d60b74444c7f807a1e0b91e1888ef0 (patch)
tree9458802b8069769c5e630ce8c4a8d4c99981ec2e /apps/files_versions
parentc1cb9ee9b0b19e17ddde046642fa01d52cda63bf (diff)
downloadnextcloud-server-9a5c2d0080d60b74444c7f807a1e0b91e1888ef0.tar.gz
nextcloud-server-9a5c2d0080d60b74444c7f807a1e0b91e1888ef0.zip
add preDelete hook for files_versions app
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/versions.php5
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);