]> source.dussan.org Git - nextcloud-server.git/commitdiff
added OC_FILESYSTEM::hash()
authorRobin Appelman <icewind1991@gmail.com>
Wed, 16 Mar 2011 16:28:01 +0000 (17:28 +0100)
committerRobin Appelman <icewind1991@gmail.com>
Thu, 17 Mar 2011 19:47:02 +0000 (20:47 +0100)
syntax is the same has http://www.php.net/manual/en/function.hash-file.php

inc/lib_filestorage.php
inc/lib_filesystem.php

index 45becf7c8f739531f18c40c704dae5b5cb761d53..68f232d3a607681b9cc2da721e5acc6a53c643a3 100644 (file)
@@ -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){}
 }
 
 
@@ -432,5 +433,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
index 26a0066aa74afab1344a1d1f31f69cf73ba23881..66da4fc3145f17f66f8bda572d491449c36871f1 100644 (file)
@@ -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);
+               }
+       }
 }
 ?>