Completed
Push — master ( ed3b9d...3835d9 )
by Roeland
20:08
created

Maintainer::configChangeHook()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.2
cc 4
eloc 3
nc 2
nop 1
1
<?php
2
/**
3
 * @author Morris Jobke <[email protected]>
4
 * @author Robin McCorkell <[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\Files_Sharing;
24
25
/**
26
 * Maintains stuff around the sharing functionality
27
 *
28
 * for example: on disable of "allow links" it removes all link shares
29
 */
30
31
class Maintainer {
32
33
	/**
34
	 * Keeps track of the "allow links" config setting
35
	 * and removes all link shares if the config option is set to "no"
36
	 *
37
	 * @param array $params array with app, key, value as named values
38
	 */
39
	static public function configChangeHook($params) {
40
		if($params['app'] === 'core' && $params['key'] === 'shareapi_allow_links' && $params['value'] === 'no') {
41
			\OCP\Share::removeAllLinkShares();
42
		}
43
	}
44
45
}
46