From feee4b865b5dc700d5380af30fc0a68949bb296c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 12 Nov 2013 14:00:36 +0100 Subject: add delete hook for trash bin app --- apps/files_trashbin/lib/trashbin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index c79afdc0c2e..4e314d62d01 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' => $path)); $trashbinSize -= $size; self::setTrashbinSize($user, $trashbinSize); -- cgit v1.2.3 From 90fac1f3712e54e3bccbad87095b04afb0f9d95a Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 12 Nov 2013 14:03:50 +0100 Subject: replace $path with '/files_trashbin/files/' . $file --- apps/files_trashbin/lib/trashbin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 4e314d62d01..f419f515f1e 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -530,7 +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' => $path)); + \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => '/files_trashbin/files/' . $file)); $trashbinSize -= $size; self::setTrashbinSize($user, $trashbinSize); -- cgit v1.2.3 From 238e4bc3eb966c0049b545f2b9cb2c45d8bef0d2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 12 Nov 2013 14:06:32 +0100 Subject: implement delete hooks in file versions lib --- apps/files_versions/lib/versions.php | 3 +++ 1 file changed, 3 insertions(+) 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 { -- cgit v1.2.3 From 49cd5dad24069cc258e98b0c7c114108a3655d17 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 12 Nov 2013 14:08:55 +0100 Subject: add trash bin and file versions delete hooks in OC::registerPreviewHooks --- lib/base.php | 2 ++ 1 file changed, 2 insertions(+) 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'); } /** -- cgit v1.2.3