Skip to content

Commit 03b1990

Browse files
committed
activity on new backup
1 parent 1f3852d commit 03b1990

File tree

98 files changed

+627
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+627
-95
lines changed

appinfo/info.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,16 @@
5252
<admin-section>OCA\Backup\Settings\AdminSection</admin-section>
5353
</settings>
5454

55+
<activity>
56+
<!-- <settings>-->
57+
<!-- <setting>OCA\Backup\Activity\GlobalSetting</setting>-->
58+
<!-- </settings>-->
59+
<filters>
60+
<filter>OCA\Backup\Activity\Filter</filter>
61+
</filters>
62+
<providers>
63+
<provider>OCA\Backup\Activity\Provider</provider>
64+
</providers>
65+
</activity>
66+
5567
</info>

lib/Activity/Filter.php

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
6+
/**
7+
* Nextcloud - Backup now. Restore Later.
8+
*
9+
* This file is licensed under the Affero General Public License version 3 or
10+
* later. See the COPYING file.
11+
*
12+
* @author Maxence Lange <maxence@artificial-owl.com>
13+
* @copyright 2021, Maxence Lange <maxence@artificial-owl.com>
14+
* @license GNU AGPL version 3 or any later version
15+
*
16+
* This program is free software: you can redistribute it and/or modify
17+
* it under the terms of the GNU Affero General Public License as
18+
* published by the Free Software Foundation, either version 3 of the
19+
* License, or (at your option) any later version.
20+
*
21+
* This program is distributed in the hope that it will be useful,
22+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+
* GNU Affero General Public License for more details.
25+
*
26+
* You should have received a copy of the GNU Affero General Public License
27+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
28+
*
29+
*/
30+
31+
32+
namespace OCA\Backup\Activity;
33+
34+
35+
use OCA\Backup\AppInfo\Application;
36+
use OCP\Activity\IFilter;
37+
use OCP\IL10N;
38+
use OCP\IURLGenerator;
39+
40+
41+
/**
42+
* Class Filter
43+
*
44+
* @package OCA\Backup\Activity
45+
*/
46+
class Filter implements IFilter {
47+
48+
49+
/** @var IL10N */
50+
protected $l10n;
51+
52+
/** @var IURLGenerator */
53+
protected $urlGenerator;
54+
55+
56+
/**
57+
* Filter constructor.
58+
*
59+
* @param IL10N $l10n
60+
* @param IURLGenerator $urlGenerator
61+
*/
62+
public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) {
63+
$this->l10n = $l10n;
64+
$this->urlGenerator = $urlGenerator;
65+
}
66+
67+
68+
/**
69+
* @return string
70+
*/
71+
public function getIdentifier(): string {
72+
return Application::APP_ID;
73+
}
74+
75+
76+
/**
77+
* @return string
78+
*/
79+
public function getName(): string {
80+
return $this->l10n->t('Backup');
81+
}
82+
83+
84+
/**
85+
* @return int
86+
*/
87+
public function getPriority(): int {
88+
return 70;
89+
}
90+
91+
92+
/**
93+
* @param string[] $types
94+
*
95+
* @return string[]
96+
*/
97+
public function filterTypes(array $types): array {
98+
return $types;
99+
}
100+
101+
102+
/**
103+
* @return string
104+
*/
105+
public function getIcon(): string {
106+
return $this->urlGenerator->getAbsoluteURL(
107+
$this->urlGenerator->imagePath(
108+
Application::APP_ID,
109+
'app.svg'
110+
)
111+
);
112+
}
113+
114+
115+
/**
116+
* @return string[]
117+
*/
118+
public function allowedApps(): array {
119+
return [Application::APP_ID];
120+
}
121+
122+
}

lib/Activity/GlobalSetting.php

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
6+
/**
7+
* Nextcloud - Backup now. Restore later.
8+
*
9+
* This file is licensed under the Affero General Public License version 3 or
10+
* later. See the COPYING file.
11+
*
12+
* @author Maxence Lange <maxence@artificial-owl.com>
13+
* @copyright 2021, Maxence Lange <maxence@artificial-owl.com>
14+
* @license GNU AGPL version 3 or any later version
15+
*
16+
* This program is free software: you can redistribute it and/or modify
17+
* it under the terms of the GNU Affero General Public License as
18+
* published by the Free Software Foundation, either version 3 of the
19+
* License, or (at your option) any later version.
20+
*
21+
* This program is distributed in the hope that it will be useful,
22+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+
* GNU Affero General Public License for more details.
25+
*
26+
* You should have received a copy of the GNU Affero General Public License
27+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
28+
*
29+
*/
30+
31+
32+
namespace OCA\Backup\Activity;
33+
34+
use OCA\Backup\AppInfo\Application;
35+
use OCP\Activity\ISetting;
36+
use OCP\IL10N;
37+
38+
39+
/**
40+
* Class Settings
41+
*
42+
* @package OCA\Backup\Activity
43+
*/
44+
class GlobalSetting implements ISetting {
45+
46+
47+
/** @var IL10N */
48+
private $l10n;
49+
50+
51+
/**
52+
* @param IL10N $l10n
53+
*/
54+
public function __construct(IL10N $l10n) {
55+
$this->l10n = $l10n;
56+
}
57+
58+
59+
/**
60+
* @return string
61+
*/
62+
public function getIdentifier(): string {
63+
return Application::APP_ID;
64+
}
65+
66+
67+
/**
68+
* @return string
69+
*/
70+
public function getName(): string {
71+
return $this->l10n->t('Update on all Backup\'s event');
72+
}
73+
74+
75+
/**
76+
* @return int
77+
*/
78+
public function getPriority(): int {
79+
return 60;
80+
}
81+
82+
/**
83+
* @return bool
84+
*/
85+
public function canChangeStream(): bool {
86+
return $this->isAdmin();
87+
}
88+
89+
/**
90+
* @return bool
91+
*/
92+
public function isDefaultEnabledStream(): bool {
93+
return $this->isAdmin();
94+
}
95+
96+
/**
97+
* @return bool
98+
*/
99+
public function canChangeMail(): bool {
100+
return $this->isAdmin();
101+
}
102+
103+
/**
104+
* @return bool
105+
*/
106+
public function isDefaultEnabledMail(): bool {
107+
return $this->isAdmin();
108+
}
109+
110+
111+
private function isAdmin(): bool {
112+
return true;
113+
}
114+
}

0 commit comments

Comments
 (0)