summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/icachefactory.php28
-rw-r--r--lib/public/iservercontainer.php7
-rw-r--r--lib/public/util.php27
3 files changed, 60 insertions, 2 deletions
diff --git a/lib/public/icachefactory.php b/lib/public/icachefactory.php
new file mode 100644
index 00000000000..874f1ec0a59
--- /dev/null
+++ b/lib/public/icachefactory.php
@@ -0,0 +1,28 @@
+<?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 ICacheFactory{
+ /**
+ * Get a memory cache instance
+ *
+ * All entries added trough the cache instance will be namespaced by $prefix to prevent collisions between apps
+ *
+ * @param string $prefix
+ * @return \OCP\ICache
+ */
+ public function create($prefix = '');
+
+ /**
+ * Check if any memory cache backend is available
+ *
+ * @return bool
+ */
+ public function isAvailable();
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index b958d2d03f4..5473f3ee334 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -142,6 +142,13 @@ interface IServerContainer {
function getCache();
/**
+ * Returns an \OCP\CacheFactory instance
+ *
+ * @return \OCP\ICacheFactory
+ */
+ function getMemCacheFactory();
+
+ /**
* Returns the current session
*
* @return \OCP\ISession
diff --git a/lib/public/util.php b/lib/public/util.php
index 52874bcc954..4611e5e2650 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -88,14 +88,18 @@ class Util {
* @param Exception $ex exception to log
*/
public static function logException( $app, \Exception $ex ) {
- $message = $ex->getMessage();
+ $class = get_class($ex);
+ if ($class !== 'Exception') {
+ $message = $class . ': ';
+ }
+ $message .= $ex->getMessage();
if ($ex->getCode()) {
$message .= ' [' . $ex->getCode() . ']';
}
\OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
if (defined('DEBUG') and DEBUG) {
// also log stack trace
- $stack = explode('#', $ex->getTraceAsString());
+ $stack = explode("\n", $ex->getTraceAsString());
// first element is empty
array_shift($stack);
foreach ($stack as $s) {
@@ -463,4 +467,23 @@ class Util {
public static function maxUploadFilesize($dir, $free = null) {
return \OC_Helper::maxUploadFilesize($dir, $free);
}
+
+ /**
+ * Calculate free space left within user quota
+ *
+ * @param $dir the current folder where the user currently operates
+ * @return number of bytes representing
+ */
+ public static function freeSpace($dir) {
+ return \OC_Helper::freeSpace($dir);
+ }
+
+ /**
+ * Calculate PHP upload limit
+ *
+ * @return number of bytes representing
+ */
+ public static function uploadLimit() {
+ return \OC_Helper::uploadLimit();
+ }
}