Completed
Push — master ( d8af9d...efa52e )
by Morris
28:06 queued 11:26
created

UpdateTheme   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A configure() 0 5 1
A execute() 0 9 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Julius Härtl <[email protected]>
4
 *
5
 * @author Julius Härtl <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 *  This program is free software: you can redistribute it and/or modify
10
 *  it under the terms of the GNU Affero General Public License as
11
 *  published by the Free Software Foundation, either version 3 of the
12
 *  License, or (at your option) any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU Affero General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU Affero General Public License
20
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OC\Core\Command\Maintenance;
25
26
use OC\Core\Command\Maintenance\Mimetype\UpdateJS;
27
use OCP\ICacheFactory;
28
use Symfony\Component\Console\Input\InputInterface;
29
use Symfony\Component\Console\Output\OutputInterface;
30
31
use OCP\Files\IMimeTypeDetector;
32
33
class UpdateTheme extends UpdateJS {
34
35
	/** @var IMimeTypeDetector */
36
	protected $mimetypeDetector;
37
38
	/** @var ICacheFactory */
39
	protected $cacheFactory;
40
41
	public function __construct(
42
		IMimeTypeDetector $mimetypeDetector,
43
		ICacheFactory $cacheFactory
44
	) {
45
		parent::__construct($mimetypeDetector);
46
		$this->cacheFactory = $cacheFactory;
47
	}
48
49
	protected function configure() {
50
		$this
51
			->setName('maintenance:theme:update')
52
			->setDescription('Apply custom theme changes');
53
	}
54
55
	protected function execute(InputInterface $input, OutputInterface $output) {
56
		// run mimetypelist.js update since themes might change mimetype icons
57
		parent::execute($input, $output);
58
59
		// cleanup image cache
60
		$c = $this->cacheFactory->create('imagePath');
61
		$c->clear('');
62
		$output->writeln('<info>Image cache cleared');
63
	}
64
}
65