2016-04-18 05:39:00 -04:00
|
|
|
<?php
|
2024-05-24 13:43:47 -04:00
|
|
|
|
2016-04-18 05:39:00 -04:00
|
|
|
/**
|
2024-05-24 13:43:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-04-18 05:39:00 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Core\Command\Maintenance;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
|
|
|
|
use OCP\IConfig;
|
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
|
|
class DataFingerprint extends Command {
|
2023-06-12 10:46:44 -04:00
|
|
|
public function __construct(
|
|
|
|
|
protected IConfig $config,
|
|
|
|
|
protected ITimeFactory $timeFactory,
|
|
|
|
|
) {
|
2016-04-18 05:39:00 -04:00
|
|
|
parent::__construct();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configure() {
|
|
|
|
|
$this
|
|
|
|
|
->setName('maintenance:data-fingerprint')
|
|
|
|
|
->setDescription('update the systems data-fingerprint after a backup is restored');
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 08:54:51 -04:00
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
2024-12-02 02:40:25 -05:00
|
|
|
$fingerPrint = md5($this->timeFactory->getTime());
|
|
|
|
|
$this->config->setSystemValue('data-fingerprint', $fingerPrint);
|
|
|
|
|
$output->writeln('<info>Updated data-fingerprint to ' . $fingerPrint . '</info>');
|
2020-06-26 08:54:51 -04:00
|
|
|
return 0;
|
2016-04-18 05:39:00 -04:00
|
|
|
}
|
|
|
|
|
}
|