|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* CMS Pico - Create websites using Pico CMS for Nextcloud. |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2017, Maxence Lange (<[email protected]>) |
|
6
|
|
|
* @copyright Copyright (c) 2019, Daniel Rudolf (<[email protected]>) |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU AGPL version 3 or any later version |
|
9
|
|
|
* |
|
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
13
|
|
|
* License, or (at your option) any later version. |
|
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 |
|
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
declare(strict_types=1); |
|
25
|
|
|
|
|
26
|
|
|
namespace OCA\CMSPico\AppInfo; |
|
27
|
|
|
|
|
28
|
|
|
use OCP\App\AppPathNotFoundException; |
|
29
|
|
|
use OCP\App\IAppManager; |
|
30
|
|
|
use OCP\AppFramework\App; |
|
31
|
|
|
use OCP\Util; |
|
32
|
|
|
|
|
33
|
|
|
class Application extends App |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var string */ |
|
36
|
|
|
const APP_NAME = 'cms_pico'; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param array $params |
|
40
|
|
|
*/ |
|
41
|
12 |
|
public function __construct(array $params = []) |
|
42
|
|
|
{ |
|
43
|
12 |
|
parent::__construct(self::APP_NAME, $params); |
|
44
|
12 |
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Register hooks. |
|
48
|
|
|
*/ |
|
49
|
|
|
public function registerHooks() |
|
50
|
|
|
{ |
|
51
|
|
|
Util::connectHook('OC_User', 'post_deleteUser', '\OCA\CMSPico\Hooks\UserHooks', 'onUserDeleted'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Returns the absolute path to this app. |
|
56
|
|
|
* |
|
57
|
|
|
* @return string |
|
58
|
|
|
*/ |
|
59
|
3 |
|
public static function getAppPath(): string |
|
60
|
|
|
{ |
|
61
|
|
|
try { |
|
62
|
|
|
/** @var IAppManager $appManager */ |
|
63
|
3 |
|
$appManager = \OC::$server->getAppManager(); |
|
64
|
3 |
|
return $appManager->getAppPath(self::APP_NAME); |
|
65
|
|
|
} catch (AppPathNotFoundException $e) { |
|
66
|
|
|
return ''; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Returns the absolute web path to this app. |
|
72
|
|
|
* |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
2 |
|
public static function getAppWebPath(): string |
|
76
|
|
|
{ |
|
77
|
2 |
|
return \OC_App::getAppWebPath(self::APP_NAME) ?: ''; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|