1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2016, Roeland Jago Douma <[email protected]> |
4
|
|
|
* @copyright Copyright (c) 2017, Matias De lellis <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Roeland Jago Douma <[email protected]> |
7
|
|
|
* @author Matias De lellis <[email protected]> |
8
|
|
|
* |
9
|
|
|
* @license GNU AGPL version 3 or any later version |
10
|
|
|
* |
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
14
|
|
|
* License, or (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* This program is distributed in the hope that it will be useful, |
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19
|
|
|
* GNU Affero General Public License for more details. |
20
|
|
|
* |
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
23
|
|
|
* |
24
|
|
|
*/ |
25
|
|
|
namespace OCA\FaceRecognition\AppInfo; |
26
|
|
|
|
27
|
|
|
use OCA\FaceRecognition\Watcher; |
28
|
|
|
|
29
|
|
|
use OCP\AppFramework\App; |
30
|
|
|
use OCP\AppFramework\IAppContainer; |
31
|
|
|
use OCP\Files\IRootFolder; |
32
|
|
|
use OCP\Files\Node; |
33
|
|
|
use OCP\IUserManager; |
34
|
|
|
|
35
|
|
|
class Application extends App { |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Application constructor. |
39
|
|
|
* |
40
|
|
|
* @param array $urlParams |
41
|
|
|
*/ |
42
|
|
|
public function __construct(array $urlParams = []) { |
43
|
|
|
parent::__construct('facerecognition', $urlParams); |
44
|
|
|
|
45
|
|
|
$this->connectWatcher(); |
46
|
|
|
$this->connectSearch(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
private function connectWatcher() { |
50
|
|
|
/** @var IRootFolder $root */ |
51
|
|
|
$root = $this->getContainer()->query(IRootFolder::class); |
52
|
|
|
|
53
|
|
|
$root->listen('\OC\Files', 'postWrite', function (Node $node) { |
54
|
|
|
/** @var Watcher $watcher */ |
55
|
|
|
$watcher = \OC::$server->query(Watcher::class); |
56
|
|
|
$watcher->postWrite($node); |
57
|
|
|
}); |
58
|
|
|
|
59
|
|
|
// We want to react on postDelete and not preDelete as in preDelete we don't know if |
60
|
|
|
// file actually got deleted (locked, other errors...) |
61
|
|
|
$root->listen('\OC\Files', 'postDelete', function (Node $node) { |
62
|
|
|
/** @var Watcher $watcher */ |
63
|
|
|
$watcher = \OC::$server->query(Watcher::class); |
64
|
|
|
$watcher->postDelete($node); |
65
|
|
|
}); |
66
|
|
|
|
67
|
|
|
// Watch for user deletion, so we clean up user data, after user gets deleted |
68
|
|
|
$userManager = $this->getContainer()->query(IUserManager::class); |
69
|
|
|
$userManager->listen('\OC\User', 'postDelete', function (\OC\User\User $user) { |
|
|
|
|
70
|
|
|
/** @var Watcher $watcher */ |
71
|
|
|
$watcher = \OC::$server->query(Watcher::class); |
72
|
|
|
$watcher->postUserDelete($user); |
73
|
|
|
}); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
private function connectSearch() { |
77
|
|
|
$this->getContainer()->getServer()->getSearch()->registerProvider( |
78
|
|
|
'OCA\FaceRecognition\Search\Provider', array('app'=>'facerecognition', 'apps' => array('files'))); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
} |
82
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths