From 83064aca51db7d8382282743ade2ab9da2a6e1b0 Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <mtgap@owncloud.com>
Date: Sun, 30 Dec 2012 19:23:31 -0500
Subject: [PATCH] Remove old etag code

---
 lib/connector/sabre/node.php | 24 ------------------------
 lib/files/filesystem.php     | 21 ---------------------
 lib/files/view.php           |  2 --
 lib/filesystem.php           |  7 -------
 4 files changed, 54 deletions(-)

diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index d4023dfad7..dd8ae152ff 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -218,28 +218,4 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
 		return null;
 	}
 
-	/**
-	 * @brief Remove the ETag from the cache.
-	 * @param string $path Path of the file
-	 */
-	static public function removeETagPropertyForPath($path) {
-		// remove tags from this and parent paths
-		$paths = array();
-		while ($path != '/' && $path != '.' && $path != '' && $path != '\\') {
-			$paths[] = $path;
-			$path = dirname($path);
-		}
-		if (empty($paths)) {
-			return;
-		}
-		$paths[] = $path;
-		$path_placeholders = join(',', array_fill(0, count($paths), '?'));
-		$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*properties`'
-			.' WHERE `userid` = ?'
-			.' AND `propertyname` = ?'
-			.' AND `propertypath` IN ('.$path_placeholders.')'
-			);
-		$vals = array( OC_User::getUser(), self::GETETAG_PROPERTYNAME );
-		$query->execute(array_merge( $vals, $paths ));
-	}
 }
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index 8183b8ff99..d62b5186cb 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -582,23 +582,6 @@ class Filesystem {
 		return self::$defaultInstance->hasUpdated($path, $time);
 	}
 
-	static public function removeETagHook($params, $root = false) {
-		if (isset($params['path'])) {
-			$path = $params['path'];
-		} else {
-			$path = $params['oldpath'];
-		}
-
-		if ($root) { // reduce path to the required part of it (no 'username/files')
-			$fakeRootView = new View($root);
-			$count = 1;
-			$path = str_replace(\OC_App::getStorage("files")->getAbsolutePath(''), "", $fakeRootView->getAbsolutePath($path), $count);
-		}
-
-		$path = self::normalizePath($path);
-		\OC_Connector_Sabre_Node::removeETagPropertyForPath($path);
-	}
-
 	/**
 	 * normalize a path
 	 *
@@ -682,10 +665,6 @@ class Filesystem {
 	}
 }
 
-\OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Filesystem', 'removeETagHook');
-\OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC_Filesystem', 'removeETagHook');
-\OC_Hook::connect('OC_Filesystem', 'post_rename', 'OC_Filesystem', 'removeETagHook');
-
 \OC_Hook::connect('OC_Filesystem', 'post_write', '\OC\Files\Cache\Updater', 'writeHook');
 \OC_Hook::connect('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Updater', 'deleteHook');
 \OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Updater', 'renameHook');
diff --git a/lib/files/view.php b/lib/files/view.php
index 592c484a21..77146895e6 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -462,8 +462,6 @@ class View {
 						Filesystem::signal_post_write,
 						array(Filesystem::signal_param_path => $path2)
 					);
-				} else { // no real copy, file comes from somewhere else, e.g. version rollback -> just update the file cache and the webdav properties without all the other post_write actions
-					Filesystem::removeETagHook(array("path" => $path2), $this->fakeRoot);
 				}
 				return $result;
 			} else {
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 20b5ab2790..57cca90230 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -398,13 +398,6 @@ class OC_Filesystem {
 		return \OC\Files\Filesystem::hasUpdated($path, $time);
 	}
 
-	/**
-	 * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
-	 */
-	static public function removeETagHook($params, $root = false) {
-		\OC\Files\Filesystem::removeETagHook($params, $root);
-	}
-
 	/**
 	 * normalize a path
 	 *
-- 
GitLab