From ef5bd659fa89e5e0284a12717d6914fd13418176 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind1991@gmail.com>
Date: Wed, 16 Mar 2011 17:28:01 +0100
Subject: added OC_FILESYSTEM::hash()

syntax is the same has http://www.php.net/manual/en/function.hash-file.php
---
 lib/filestorage.php | 8 ++++++++
 lib/filesystem.php  | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/lib/filestorage.php b/lib/filestorage.php
index 06ce26f0d23..3a0d124cbf2 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -73,6 +73,7 @@ class OC_FILESTORAGE{
 	public function delTree($path){}
 	public function find($path){}
 	public function getTree($path){}
+	public function hash($type,$path,$raw){}
 }
 
 
@@ -428,5 +429,12 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
 		}
 		return $tree;
 	}
+
+	public function hash($type,$path,$raw){
+		if($return=hash_file($type,$this->datadir.$path,$raw)){
+			$this->notifyObservers($path,OC_FILEACTION_READ);
+		}
+		return $return;
+	}
 }
 ?>
\ No newline at end of file
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 26a0066aa74..66da4fc3145 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -376,5 +376,10 @@ class OC_FILESYSTEM{
 			return $return;
 		}
 	}
+	static public function hash($type,$path,$raw=false){
+		if(self::canRead($path) and $storage=self::getStorage($path)){
+			return $storage->hash($type,self::getInternalPath($path),$raw);
+		}
+	}
 }
 ?>
-- 
cgit v1.2.3