1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
4
|
|
|
* @copyright Copyright (c) 2017, Joas Schilling <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Joas Schilling <[email protected]> |
7
|
|
|
* @author Vincent Petry <[email protected]> |
8
|
|
|
* |
9
|
|
|
* @license AGPL-3.0 |
10
|
|
|
* |
11
|
|
|
* This code is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
13
|
|
|
* as published by the Free Software Foundation. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU Affero General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace OCA\Activity; |
26
|
|
|
|
27
|
|
|
use OCP\Share\IShare; |
28
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The class to handle the filesystem hooks |
32
|
|
|
*/ |
33
|
|
|
class FilesHooksStatic { |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @return FilesHooks |
37
|
|
|
*/ |
38
|
|
|
static protected function getHooks() { |
39
|
|
|
return \OC::$server->query(FilesHooks::class); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Store the create hook events |
44
|
|
|
* @param array $params The hook params |
45
|
|
|
*/ |
46
|
|
|
public static function fileCreate($params) { |
47
|
|
|
self::getHooks()->fileCreate($params['path']); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Store the update hook events |
52
|
|
|
* @param array $params The hook params |
53
|
|
|
*/ |
54
|
|
|
public static function fileUpdate($params) { |
55
|
|
|
self::getHooks()->fileUpdate($params['path']); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Store the delete hook events |
60
|
|
|
* @param array $params The hook params |
61
|
|
|
*/ |
62
|
|
|
public static function fileDelete($params) { |
63
|
|
|
self::getHooks()->fileDelete($params['path']); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Store the rename hook events |
68
|
|
|
* @param array $params The hook params |
69
|
|
|
*/ |
70
|
|
|
public static function fileMove($params) { |
71
|
|
|
self::getHooks()->fileMove($params['oldpath'], $params['newpath']); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Store the rename hook events |
76
|
|
|
* @param array $params The hook params |
77
|
|
|
*/ |
78
|
|
|
public static function fileMovePost($params) { |
79
|
|
|
self::getHooks()->fileMovePost($params['oldpath'], $params['newpath']); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Store the restore hook events |
84
|
|
|
* @param array $params The hook params |
85
|
|
|
*/ |
86
|
|
|
public static function fileRestore($params) { |
87
|
|
|
self::getHooks()->fileRestore($params['filePath']); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Manage sharing events |
92
|
|
|
* @param array $params The hook params |
93
|
|
|
*/ |
94
|
|
|
public static function share($params) { |
95
|
|
|
self::getHooks()->share($params); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Unsharing event |
100
|
|
|
* @param GenericEvent $event |
101
|
|
|
*/ |
102
|
|
|
public static function unShare(GenericEvent $event) { |
103
|
|
|
$share = $event->getSubject(); |
104
|
|
|
if ($share instanceof IShare) { |
|
|
|
|
105
|
|
|
self::getHooks()->unShare($share); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.