]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add coments to database and dont use sql keywords as table names
authorRobin Appelman <icewind@owncloud.com>
Wed, 7 May 2014 11:19:41 +0000 (13:19 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Sat, 14 Jun 2014 08:10:38 +0000 (10:10 +0200)
apps/files_sharing/appinfo/database.xml
apps/files_sharing/lib/external/manager.php

index b9c0d881fc6d50199fe716619d21d00ae99b6e03..e55688240b2c4e87a3f6d3bc633ac3c8604672a6 100644 (file)
                                <name>remote</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>128</length>
+                               <length>512</length>
+                               <comments>Url of the remove owncloud instance</comments>
                        </field>
                        <field>
-                               <name>token</name>
+                               <name>share_token</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>64</length>
+                               <comments>Public share token</comments>
                        </field>
                        <field>
                                <name>password</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>64</length>
+                               <comments>Optional password for the public share</comments>
                        </field>
                        <field>
                                <name>name</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>64</length>
+                               <comments>Original name on the remote server</comments>
                        </field>
                        <field>
                                <name>owner</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>64</length>
+                               <comments>User that owns the public share on the remote server</comments>
                        </field>
                        <field>
                                <name>user</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>64</length>
+                               <comments>Local user which added the external share</comments>
                        </field>
                        <field>
                                <name>mountpoint</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>512</length>
+                               <comments>Full path where the share is mounted</comments>
                        </field>
                        <field>
                                <name>mountpoint_hash</name>
                                <type>text</type>
                                <notnull>true</notnull>
                                <length>32</length>
+                               <comments>md5 hash of the mountpoint</comments>
                        </field>
                        <index>
                                <name>sh_external_user</name>
index d82cb83a6e718195c742cd2b4b7233893d189ac3..fa0005389a74bf1f1a4899c12810fc46f483422a 100644 (file)
@@ -50,7 +50,7 @@ class Manager {
        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`,
+                       $query = $this->connection->prepare('INSERT INTO *PREFIX*share_external(`remote`, `share_token`, `password`,
                                `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`) VALUES(?, ?, ?, ?, ?, ?, ?, ?)');
                        $mountPoint = '/' . $user->getUID() . '/files/' . $name;
                        $hash = md5($mountPoint);
@@ -71,12 +71,13 @@ class Manager {
        public function setup() {
                $user = $this->userSession->getUser();
                if ($user) {
-                       $query = $this->connection->prepare('SELECT `remote`, `token`, `password`, `mountpoint`, `owner`
+                       $query = $this->connection->prepare('SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
                        FROM *PREFIX*share_external WHERE `user` = ?');
                        $query->execute(array($user->getUID()));
 
                        while ($row = $query->fetch()) {
                                $row['manager'] = $this;
+                               $row['token'] = $row['share_token'];
                                $mount = new Mount(self::STORAGE, $row['mountpoint'], $row, $this->storageLoader);
                                $this->mountManager->addMount($mount);
                        }
@@ -109,7 +110,7 @@ class Manager {
                $this->mountManager->removeMount($source . '/');
        }
 
-       public function remoteShare($mountPoint) {
+       public function removeShare($mountPoint) {
                $hash = md5($mountPoint);
                $query = $this->connection->prepare('DELETE FROM *PREFIX*share_external WHERE `mountpoint_hash` = ?');
                $query->execute(array($hash));