diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-11-12 07:03:37 -0800 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-11-12 07:03:37 -0800 |
commit | dc30056025f63d32de0846bdf14e971988f83cdb (patch) | |
tree | 0c68eb491217bd14b8d2f821d7923aea0537014b | |
parent | a745901d50c67728c0a8b7f0a8820ebd6992bad6 (diff) | |
parent | 49cd5dad24069cc258e98b0c7c114108a3655d17 (diff) | |
download | nextcloud-server-dc30056025f63d32de0846bdf14e971988f83cdb.tar.gz nextcloud-server-dc30056025f63d32de0846bdf14e971988f83cdb.zip |
Merge pull request #5822 from owncloud/delete_hooks_trash_and_versions
Implement delete hooks for trashbin and filesversions apps.
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 1 | ||||
-rw-r--r-- | apps/files_versions/lib/versions.php | 3 | ||||
-rw-r--r-- | lib/base.php | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index c79afdc0c2e..f419f515f1e 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -530,6 +530,7 @@ class Trashbin { $size += $view->filesize('/files_trashbin/files/' . $file); } $view->unlink('/files_trashbin/files/' . $file); + \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => '/files_trashbin/files/' . $file)); $trashbinSize -= $size; self::setTrashbinSize($user, $trashbinSize); diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index 225611374a6..661e98b09d5 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -156,6 +156,7 @@ class Storage { } foreach ($versions as $v) { unlink($abs_path . $v['version']); + \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $abs_path . $v['version'])); $versionsSize -= $v['size']; } self::setVersionsSize($uid, $versionsSize); @@ -465,6 +466,7 @@ class Storage { while ($availableSpace < 0 && $i < $numOfVersions) { $version = current($allVersions); $versionsFileview->unlink($version['path'].'.v'.$version['version']); + \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'])); $versionsSize -= $version['size']; $availableSpace += $version['size']; next($allVersions); @@ -515,6 +517,7 @@ class Storage { if ($version['version'] > $nextVersion) { //distance between two version too small, delete version $versionsFileview->unlink($version['path'] . '.v' . $version['version']); + \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'] . '.v' . $version['version'])); $size += $version['size']; unset($allVersions[$key]); // update array with all versions } else { diff --git a/lib/base.php b/lib/base.php index 81e0f77aa80..f3983a3800f 100644 --- a/lib/base.php +++ b/lib/base.php @@ -619,6 +619,8 @@ class OC { public static function registerPreviewHooks() { OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write'); OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete'); + OC_Hook::connect('\OCP\Versions', 'delete', 'OC\Preview', 'post_delete'); + OC_Hook::connect('\OCP\Trashbin', 'delete', 'OC\Preview', 'post_delete'); } /** |