summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-23 17:16:16 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-23 17:16:16 +0200
commit1909288fcb9231006ae7703422f046309635b4e2 (patch)
treea9c1a75169dca9023d629176d9c395433d9d742c /lib/public
parentf9bbfad3e561c52cd3a7a9002ed9708a87237dc5 (diff)
parent3d5e229ac5f6f93c4e9a5176eb3fe70b7cae80cf (diff)
downloadnextcloud-server-1909288fcb9231006ae7703422f046309635b4e2.tar.gz
nextcloud-server-1909288fcb9231006ae7703422f046309635b4e2.zip
Merge branch 'master' into fix-sharing-code
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/activity/iconsumer.php42
-rw-r--r--lib/public/activity/imanager.php54
-rw-r--r--lib/public/appframework/http.php (renamed from lib/public/appframework/http/http.php)2
-rw-r--r--lib/public/appframework/http/jsonresponse.php1
-rw-r--r--lib/public/appframework/http/response.php1
-rw-r--r--lib/public/iservercontainer.php7
-rw-r--r--lib/public/share.php17
-rw-r--r--lib/public/util.php33
8 files changed, 156 insertions, 1 deletions
diff --git a/lib/public/activity/iconsumer.php b/lib/public/activity/iconsumer.php
new file mode 100644
index 00000000000..ca9bd5096b3
--- /dev/null
+++ b/lib/public/activity/iconsumer.php
@@ -0,0 +1,42 @@
+<?php
+ /**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OCP\Activity;
+
+interface IConsumer {
+ /**
+ * @param $app
+ * @param $subject
+ * @param $subjectParams
+ * @param $message
+ * @param $messageParams
+ * @param $file
+ * @param $link
+ * @param $affectedUser
+ * @param $type
+ * @param $priority
+ * @return mixed
+ */
+ function receive($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority );
+}
+
diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php
new file mode 100644
index 00000000000..99ac2a1958e
--- /dev/null
+++ b/lib/public/activity/imanager.php
@@ -0,0 +1,54 @@
+<?php
+ /**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OCP\Activity;
+
+interface IManager {
+
+ /**
+ * @param $app
+ * @param $subject
+ * @param $subjectParams
+ * @param $message
+ * @param $messageParams
+ * @param $file
+ * @param $link
+ * @param $affectedUser
+ * @param $type
+ * @param $priority
+ * @return mixed
+ */
+ function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
+
+ /**
+ * In order to improve lazy loading a closure can be registered which will be called in case
+ * activity consumers are actually requested
+ *
+ * $callable has to return an instance of OCA\Activity\IConsumer
+ *
+ * @param string $key
+ * @param \Closure $callable
+ */
+ function registerConsumer(\Closure $callable);
+
+}
diff --git a/lib/public/appframework/http/http.php b/lib/public/appframework/http.php
index 9eafe782726..c05d8f8e46e 100644
--- a/lib/public/appframework/http/http.php
+++ b/lib/public/appframework/http.php
@@ -22,7 +22,7 @@
*/
-namespace OCP\AppFramework\Http;
+namespace OCP\AppFramework;
class Http {
diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index 085fdbed2f9..fa7d32596e8 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -24,6 +24,7 @@
namespace OCP\AppFramework\Http;
+use OCP\AppFramework\Http;
/**
* A renderer for JSON calls
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index 5ca389b9946..54dc860fec2 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -24,6 +24,7 @@
namespace OCP\AppFramework\Http;
+use OCP\AppFramework\Http;
/**
* Base class for responses. Also used to just send headers.
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index 3afb2b6599d..cc9436a75c8 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -133,6 +133,13 @@ interface IServerContainer {
function getSession();
/**
+ * Returns the activity manager
+ *
+ * @return \OCP\Activity\IManager
+ */
+ function getActivityManager();
+
+ /**
* Returns the current session
*
* @return \OCP\IDBConnection
diff --git a/lib/public/share.php b/lib/public/share.php
index 814c02499f3..dec79d998e3 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -969,6 +969,10 @@ class Share {
$queryArgs = array($itemType);
}
}
+ if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
+ $where .= ' AND `share_type` != ?';
+ $queryArgs[] = self::SHARE_TYPE_LINK;
+ }
if (isset($shareType)) {
// Include all user and group items
if ($shareType == self::$shareTypeUserAndGroups && isset($shareWith)) {
@@ -1489,6 +1493,7 @@ class Share {
'id' => $parent,
'token' => $token
));
+
if ($parentFolder === true) {
// Return parent folders to preserve file target paths for potential children
return $parentFolders;
@@ -1736,6 +1741,18 @@ class Share {
}
/**
+ * Delete all shares with type SHARE_TYPE_LINK
+ */
+ public static function removeAllLinkShares() {
+ // Delete any link shares
+ $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*share` WHERE `share_type` = ?');
+ $result = $query->execute(array(self::SHARE_TYPE_LINK));
+ while ($item = $result->fetchRow()) {
+ self::delete($item['id']);
+ }
+ }
+
+ /**
* Hook Listeners
*/
diff --git a/lib/public/util.php b/lib/public/util.php
index b33f07b55e6..ed0622b8d16 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -78,6 +78,39 @@ class Util {
}
/**
+ * @brief write exception into the log. Include the stack trace
+ * if DEBUG mode is enabled
+ * @param Exception $ex exception to log
+ */
+ public static function logException( $app, \Exception $ex ) {
+ $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());
+ // first element is empty
+ array_shift($stack);
+ foreach ($stack as $s) {
+ \OCP\Util::writeLog($app, 'Exception: ' . $s, \OCP\Util::FATAL);
+ }
+
+ // include cause
+ $l = \OC_L10N::get('lib');
+ while (method_exists($ex, 'getPrevious') && $ex = $ex->getPrevious()) {
+ $message .= ' - '.$l->t('Caused by:').' ';
+ $message .= $ex->getMessage();
+ if ($ex->getCode()) {
+ $message .= '[' . $ex->getCode() . '] ';
+ }
+ \OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
+ }
+ }
+ }
+
+ /**
* @brief get l10n object
* @param string $app
* @return OC_L10N