added static function registerHooks() for better unit tests handling

This commit is contained in:
Florin Peter 2013-05-22 23:50:45 +02:00
parent b2aa97f166
commit 842d0608f1
2 changed files with 12 additions and 5 deletions

View File

@ -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");
// register hooks
\OCA\Files_Trashbin\Trashbin::registerHooks();

View File

@ -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");
}
}