]> source.dussan.org Git - nextcloud-server.git/commitdiff
- delete properties on node delete
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 22 Oct 2013 17:41:26 +0000 (19:41 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 22 Oct 2013 17:41:26 +0000 (19:41 +0200)
- move properties on node move

lib/private/connector/sabre/file.php
lib/private/connector/sabre/node.php
lib/private/connector/sabre/objecttree.php

index 3402946a136b867df5550df582ae8505382c5560..6ace8d14484ff1cfc2c89d7da01025fae0895ce4 100644 (file)
@@ -148,6 +148,9 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
                }
                \OC\Files\Filesystem::unlink($this->path);
 
+               // remove properties
+               $this->removeProperties();
+
        }
 
        /**
index c38e9f86375f1f8be7c2052111d751f9187582be..3c2ad60f1dd6c81a74050b20334b1edbbe05f3ae 100644 (file)
@@ -190,6 +190,17 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
                return true;
        }
 
+       /**
+        * removes all properties for this node and user
+        */
+       public function removeProperties() {
+               $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*properties`'
+               .' WHERE `userid` = ? AND `propertypath` = ?' );
+               $query->execute( array( OC_User::getUser(), $this->path));
+
+               $this->setPropertyCache(null);
+       }
+
        /**
         * @brief Returns a list of properties for this nodes.;
         * @param array $properties
index df8902f66e2566a7e203949d235d4f9d2bcd72b2..cd3f081f7ccf73d4e8e31be9657f503ca73071f1 100644 (file)
@@ -97,6 +97,11 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
                        throw new \Sabre_DAV_Exception_Forbidden('');
                }
 
+               // update properties
+               $query = \OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ?'
+               .' WHERE `userid` = ? AND `propertypath` = ?' );
+               $query->execute( array( $destinationPath, \OC_User::getUser(), $sourcePath ));
+
                $this->markDirty($sourceDir);
                $this->markDirty($destinationDir);