From 842d0608f12462d38bd7c03ba9701f83f8af9ad7 Mon Sep 17 00:00:00 2001
From: Florin Peter <github@florin-peter.de>
Date: Wed, 22 May 2013 23:50:45 +0200
Subject: [PATCH] added static function registerHooks() for better unit tests
 handling

---
 apps/files_trashbin/appinfo/app.php |  6 ++----
 apps/files_trashbin/lib/trash.php   | 11 ++++++++++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php
index e83d3b8fbb..3b1e0ac30c 100644
--- a/apps/files_trashbin/appinfo/app.php
+++ b/apps/files_trashbin/appinfo/app.php
@@ -3,7 +3,5 @@
 OC::$CLASSPATH['OCA\Files_Trashbin\Hooks'] = 'files_trashbin/lib/hooks.php';
 OC::$CLASSPATH['OCA\Files_Trashbin\Trashbin'] = 'files_trashbin/lib/trash.php';
 
-//Listen to delete file signal
-OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Files_Trashbin\Hooks", "remove_hook");
-//Listen to delete user signal
-OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook");
\ No newline at end of file
+// register hooks
+\OCA\Files_Trashbin\Trashbin::registerHooks();
\ No newline at end of file
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index 70df9e2426..2d1830a38f 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -833,5 +833,14 @@ class Trashbin {
 		}
 		$query->execute(array($size, $user));
 	}
-	
+
+	/**
+	 * register hooks
+	 */
+	public static function registerHooks() {
+		//Listen to delete file signal
+		\OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Files_Trashbin\Hooks", "remove_hook");
+		//Listen to delete user signal
+		\OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook");
+	}
 }
-- 
GitLab