diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-10-22 17:33:36 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-10-24 12:18:46 +0200 |
commit | 83c74b80ad826af60d894ba91bb1e56fd2005d32 (patch) | |
tree | a9729bb74e9a69ef5e05cca79cf2ae798a4c51de /lib/public | |
parent | 0525341a1243bcf1ef992407af524e391efd7624 (diff) | |
download | nextcloud-server-83c74b80ad826af60d894ba91bb1e56fd2005d32.tar.gz nextcloud-server-83c74b80ad826af60d894ba91bb1e56fd2005d32.zip |
Add \OC\TempManager to handle creating and cleaning temporary files
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/iservercontainer.php | 7 | ||||
-rw-r--r-- | lib/public/itempmanager.php | 38 |
2 files changed, 45 insertions, 0 deletions
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 55c2c89b710..c1592551978 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -264,4 +264,11 @@ interface IServerContainer { * @return \OCP\Diagnostics\IQueryLogger */ function getQueryLogger(); + + /** + * Get the manager for temporary files and folders + * + * @return \OCP\ITempManager + */ + function getTempManager(); } diff --git a/lib/public/itempmanager.php b/lib/public/itempmanager.php new file mode 100644 index 00000000000..ebd94978038 --- /dev/null +++ b/lib/public/itempmanager.php @@ -0,0 +1,38 @@ +<?php + +/** + * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCP; + +interface ITempManager { + /** + * Create a temporary file and return the path + * + * @param string $postFix + * @return string + */ + public function getTemporaryFile($postFix = ''); + + /** + * Create a temporary folder and return the path + * + * @param string $postFix + * @return string + */ + public function getTemporaryFolder($postFix = ''); + + /** + * Remove the temporary files and folders generated during this request + */ + public function clean(); + + /** + * Remove old temporary files and folders that were failed to be cleaned + */ + public function cleanOld(); +} |