nextcloud/lib/private/Files/Storage/Temporary.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
752 B
PHP
Raw Normal View History

2012-09-07 12:30:48 -04:00
<?php
2012-09-07 12:30:48 -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;
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
*/
class Temporary extends Local {
public function __construct(array $parameters = []) {
parent::__construct(['datadir' => Server::get(ITempManager::class)->getTemporaryFolder()]);
2012-09-07 12:30:48 -04:00
}
public function cleanUp(): void {
Files::rmdirr($this->datadir);
2012-09-07 12:30:48 -04:00
}
public function __destruct() {
parent::__destruct();
2012-09-07 12:30:48 -04:00
$this->cleanUp();
}
public function getDataDir(): array|string {
return $this->datadir;
}
2012-09-07 12:30:48 -04:00
}