2012-09-07 12:30:48 -04:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2012-09-07 12:30:48 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2012-09-07 12:30:48 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Files\Storage;
|
|
|
|
|
|
2025-05-14 05:52:35 -04:00
|
|
|
use OCP\Files;
|
|
|
|
|
use OCP\ITempManager;
|
|
|
|
|
use OCP\Server;
|
|
|
|
|
|
2012-09-07 12:30:48 -04:00
|
|
|
/**
|
2013-02-05 10:24:40 -05:00
|
|
|
* local storage backend in temporary folder for testing purpose
|
2012-09-07 12:30:48 -04:00
|
|
|
*/
|
2012-09-22 09:03:17 -04:00
|
|
|
class Temporary extends Local {
|
2024-10-08 09:13:16 -04:00
|
|
|
public function __construct(array $parameters = []) {
|
2025-05-14 05:52:35 -04:00
|
|
|
parent::__construct(['datadir' => Server::get(ITempManager::class)->getTemporaryFolder()]);
|
2012-09-07 12:30:48 -04:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 12:19:34 -04:00
|
|
|
public function cleanUp(): void {
|
2025-05-14 05:52:35 -04:00
|
|
|
Files::rmdirr($this->datadir);
|
2012-09-07 12:30:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __destruct() {
|
2013-02-09 11:16:13 -05:00
|
|
|
parent::__destruct();
|
2012-09-07 12:30:48 -04:00
|
|
|
$this->cleanUp();
|
|
|
|
|
}
|
2014-06-05 15:00:50 -04:00
|
|
|
|
2024-09-19 12:19:34 -04:00
|
|
|
public function getDataDir(): array|string {
|
2014-06-05 15:00:50 -04:00
|
|
|
return $this->datadir;
|
|
|
|
|
}
|
2012-09-07 12:30:48 -04:00
|
|
|
}
|