[Pkg-owncloud-commits] [owncloud] 103/223: add remote/add external shares to manager

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit a44baaf8eb9584c3525584ff893bad47adb0d375
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri May 2 11:27:40 2014 +0200

    add remote/add external shares to manager
---
 apps/files_sharing/lib/external/manager.php | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php
index ffb6737..d82cb83 100644
--- a/apps/files_sharing/lib/external/manager.php
+++ b/apps/files_sharing/lib/external/manager.php
@@ -47,6 +47,27 @@ class Manager {
 		$this->storageLoader = $storageLoader;
 	}
 
+	public function addShare($remote, $token, $password, $name, $owner) {
+		$user = $this->userSession->getUser();
+		if ($user) {
+			$query = $this->connection->prepare('INSERT INTO *PREFIX*share_external(`remote`, `token`, `password`,
+				`name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)');
+			$mountPoint = '/' . $user->getUID() . '/files/' . $name;
+			$hash = md5($mountPoint);
+			$query->execute(array($remote, $token, $password, $name, $owner, $user->getUID(), $mountPoint, $hash));
+
+			$options = array(
+				'remote' => $remote,
+				'token' => $token,
+				'password' => $password,
+				'mountpoint' => $mountPoint,
+				'owner' => $owner
+			);
+			$mount = new Mount(self::STORAGE, $mountPoint, $options, $this->storageLoader);
+			$this->mountManager->addMount($mount);
+		}
+	}
+
 	public function setup() {
 		$user = $this->userSession->getUser();
 		if ($user) {
@@ -87,4 +108,10 @@ class Manager {
 		$this->mountManager->addMount($mount);
 		$this->mountManager->removeMount($source . '/');
 	}
+
+	public function remoteShare($mountPoint) {
+		$hash = md5($mountPoint);
+		$query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ?');
+		$query->execute(array($hash));
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list