Completed
Push — master ( 718697...0c5f91 )
by Roeland
09:37
created

DataFingerprint::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
/**
3
 * @author Roeland Jago Douma <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2016, ownCloud, Inc.
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
namespace OC\Core\Command\Maintenance;
22
23
use OCP\AppFramework\Utility\ITimeFactory;
24
use OCP\IConfig;
25
use Symfony\Component\Console\Command\Command;
26
use Symfony\Component\Console\Input\InputInterface;
27
use Symfony\Component\Console\Output\OutputInterface;
28
29
30
class DataFingerprint extends Command {
31
32
	/** @var IConfig */
33
	protected $config;
34
	/** @var ITimeFactory */
35
	protected $timeFactory;
36
37
	public function __construct(IConfig $config,
38
								ITimeFactory $timeFactory) {
39
		$this->config = $config;
40
		$this->timeFactory = $timeFactory;
41
		parent::__construct();
42
	}
43
44
	protected function configure() {
45
		$this
46
			->setName('maintenance:data-fingerprint')
47
			->setDescription('update the systems data-fingerprint after a backup is restored');
48
	}
49
50
	protected function execute(InputInterface $input, OutputInterface $output) {
51
		$this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime()));
52
	}
53
}
54