1<?php 2/** 3 * @author Morris Jobke <hey@morrisjobke.de> 4 * @author Robin Appelman <icewind@owncloud.com> 5 * @author Thomas Müller <thomas.mueller@tmit.eu> 6 * @author Vincent Petry <pvince81@owncloud.com> 7 * 8 * @copyright Copyright (c) 2018, ownCloud GmbH 9 * @license AGPL-3.0 10 * 11 * This code is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Affero General Public License, version 3, 13 * as published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Affero General Public License for more details. 19 * 20 * You should have received a copy of the GNU Affero General Public License, version 3, 21 * along with this program. If not, see <http://www.gnu.org/licenses/> 22 * 23 */ 24 25namespace OC\Files\Storage; 26 27/** 28 * local storage backend in temporary folder for testing purpose 29 */ 30class Temporary extends Local { 31 public function __construct($arguments = null) { 32 if (!\is_array($arguments)) { 33 $arguments = []; 34 } 35 $arguments['datadir'] = \OC::$server->getTempManager()->getTemporaryFolder(); 36 parent::__construct($arguments); 37 } 38 39 public function cleanUp() { 40 \OC_Helper::rmdirr($this->datadir); 41 } 42 43 public function __destruct() { 44 parent::__destruct(); 45 $this->cleanUp(); 46 } 47 48 public function getDataDir() { 49 return $this->datadir; 50 } 51 52 public function getAvailability() { 53 return ['available' => true, 'last_checked' => 0]; 54 } 55} 56