Temporary.php 694 B

123456789101112131415161718192021222324252627282930
  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\Files\Storage;
  8. /**
  9. * local storage backend in temporary folder for testing purpose
  10. */
  11. class Temporary extends Local {
  12. public function __construct($arguments = []) {
  13. parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]);
  14. }
  15. public function cleanUp(): void {
  16. \OC_Helper::rmdirr($this->datadir);
  17. }
  18. public function __destruct() {
  19. parent::__destruct();
  20. $this->cleanUp();
  21. }
  22. public function getDataDir(): array|string {
  23. return $this->datadir;
  24. }
  25. }