RemoveLegacyDatadirFile.php 680 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Repair\NC30;
  8. use OCP\IConfig;
  9. use OCP\Migration\IOutput;
  10. use OCP\Migration\IRepairStep;
  11. class RemoveLegacyDatadirFile implements IRepairStep {
  12. public function __construct(
  13. private IConfig $config,
  14. ) {
  15. }
  16. public function getName(): string {
  17. return 'Remove legacy ".ocdata" file';
  18. }
  19. public function run(IOutput $output): void {
  20. $ocdata = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata';
  21. if (file_exists($ocdata)) {
  22. unlink($ocdata);
  23. }
  24. }
  25. }