DataFingerprint.php 976 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Core\Command\Maintenance;
  8. use OCP\AppFramework\Utility\ITimeFactory;
  9. use OCP\IConfig;
  10. use Symfony\Component\Console\Command\Command;
  11. use Symfony\Component\Console\Input\InputInterface;
  12. use Symfony\Component\Console\Output\OutputInterface;
  13. class DataFingerprint extends Command {
  14. public function __construct(
  15. protected IConfig $config,
  16. protected ITimeFactory $timeFactory,
  17. ) {
  18. parent::__construct();
  19. }
  20. protected function configure() {
  21. $this
  22. ->setName('maintenance:data-fingerprint')
  23. ->setDescription('update the systems data-fingerprint after a backup is restored');
  24. }
  25. protected function execute(InputInterface $input, OutputInterface $output): int {
  26. $this->config->setSystemValue('data-fingerprint', md5($this->timeFactory->getTime()));
  27. return 0;
  28. }
  29. }