From 344606b2c80d0384364d0c691aedb45c7476df5c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Oct 2014 17:33:36 +0200 Subject: Add \OC\TempManager to handle creating and cleaning temporary files Conflicts: lib/private/server.php lib/public/iservercontainer.php --- lib/public/iservercontainer.php | 7 +++++++ lib/public/itempmanager.php | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 lib/public/itempmanager.php (limited to 'lib/public') diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index d1d6487d8cb..f9adc46c3d9 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -232,4 +232,11 @@ interface IServerContainer { * @return \OC\HTTPHelper */ function getHTTPHelper(); + + /** + * 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 @@ + + * 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(); +} -- cgit v1.2.3