1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Joas Schilling <[email protected]> |
4
|
|
|
* @author Vincent Petry <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
7
|
|
|
* @license AGPL-3.0 |
8
|
|
|
* |
9
|
|
|
* This code is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
11
|
|
|
* as published by the Free Software Foundation. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU Affero General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
19
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
namespace OCA\Activity; |
24
|
|
|
|
25
|
|
|
use OCP\Util; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The class to handle the filesystem hooks |
29
|
|
|
*/ |
30
|
|
|
class FilesHooksStatic { |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return FilesHooks |
34
|
|
|
*/ |
35
|
|
|
static protected function getHooks() { |
36
|
|
|
$app = new AppInfo\Application(); |
37
|
|
|
return $app->getContainer()->query('Hooks'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Store the create hook events |
42
|
|
|
* @param array $params The hook params |
43
|
|
|
*/ |
44
|
|
|
public static function fileCreate($params) { |
45
|
|
|
self::getHooks()->fileCreate($params['path']); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Store the update hook events |
50
|
|
|
* @param array $params The hook params |
51
|
|
|
*/ |
52
|
|
|
public static function fileUpdate($params) { |
53
|
|
|
self::getHooks()->fileUpdate($params['path']); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Store the delete hook events |
58
|
|
|
* @param array $params The hook params |
59
|
|
|
*/ |
60
|
|
|
public static function fileDelete($params) { |
61
|
|
|
self::getHooks()->fileDelete($params['path']); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Store the restore hook events |
66
|
|
|
* @param array $params The hook params |
67
|
|
|
*/ |
68
|
|
|
public static function fileRestore($params) { |
69
|
|
|
self::getHooks()->fileRestore($params['filePath']); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Manage sharing events |
74
|
|
|
* @param array $params The hook params |
75
|
|
|
*/ |
76
|
|
|
public static function share($params) { |
77
|
|
|
self::getHooks()->share($params); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Manage sharing events |
82
|
|
|
* @param array $params The hook params |
83
|
|
|
*/ |
84
|
|
|
public static function unShare($params) { |
85
|
|
|
self::getHooks()->unShare($params); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Load additional scripts when the files app is visible |
90
|
|
|
*/ |
91
|
|
|
public static function onLoadFilesAppScripts() { |
92
|
|
|
Util::addStyle('activity', 'style'); |
93
|
|
|
Util::addScript('activity', 'formatter'); |
94
|
|
|
Util::addScript('activity', 'activitymodel'); |
95
|
|
|
Util::addScript('activity', 'activitycollection'); |
96
|
|
|
Util::addScript('activity', 'activitytabview'); |
97
|
|
|
Util::addScript('activity', 'filesplugin'); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|