aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-25 16:54:46 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-25 16:55:01 -0400
commitf25ccaff59c135d7f1f22196bf266916ef131b35 (patch)
treed11baa501500bbb3bc25ab9b2beecfc9a03de47e
parent37bccf54f27288b99468467457a4740f32745366 (diff)
downloadnextcloud-server-f25ccaff59c135d7f1f22196bf266916ef131b35.tar.gz
nextcloud-server-f25ccaff59c135d7f1f22196bf266916ef131b35.zip
Fix filesystem hash, no longer using basicOperation()
-rw-r--r--apps/files_sharing/sharedstorage.php2
-rw-r--r--lib/filestorage.php2
-rw-r--r--lib/filestorage/common.php2
-rw-r--r--lib/filesystem.php4
-rw-r--r--lib/filesystemview.php23
5 files changed, 26 insertions, 7 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 32fd2124429..fc0d272b54e 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -410,7 +410,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
}
}
- public function hash($type, $path, $raw) {
+ public function hash($type, $path, $raw = false) {
$source = $this->getSource($path);
if ($source) {
$storage = OC_Filesystem::getStorage($source);
diff --git a/lib/filestorage.php b/lib/filestorage.php
index e786127d525..fd4ad36530e 100644
--- a/lib/filestorage.php
+++ b/lib/filestorage.php
@@ -45,7 +45,7 @@ abstract class OC_Filestorage{
abstract public function copy($path1,$path2);
abstract public function fopen($path,$mode);
abstract public function getMimeType($path);
- abstract public function hash($type,$path,$raw);
+ abstract public function hash($type,$path,$raw = false);
abstract public function free_space($path);
abstract public function search($query);
abstract public function touch($path, $mtime=null);
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index fd389d3e2d7..c77df38e6b1 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -195,7 +195,7 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
unlink($tmpFile);
return $mime;
}
- public function hash($type,$path,$raw){
+ public function hash($type,$path,$raw = false){
$tmpFile=$this->getLocalFile();
$hash=hash($type,$tmpFile,$raw);
unlink($tmpFile);
diff --git a/lib/filesystem.php b/lib/filesystem.php
index a5edcf5bab3..81370d4e178 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -452,8 +452,8 @@ class OC_Filesystem{
static public function getMimeType($path){
return self::$defaultInstance->getMimeType($path);
}
- static public function hash($type,$path){
- return self::$defaultInstance->hash($type,$path);
+ static public function hash($type,$path, $raw = false){
+ return self::$defaultInstance->hash($type,$path, $raw);
}
static public function free_space($path='/'){
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 9beda01e5a1..3c989d7c36f 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -465,8 +465,27 @@ class OC_FilesystemView {
public function getMimeType($path) {
return $this->basicOperation('getMimeType', $path);
}
- public function hash($type, $path) {
- return $this->basicOperation('hash', $path, array('read'), $type);
+ public function hash($type, $path, $raw = false) {
+ $absolutePath = $this->getAbsolutePath($path);
+ if (OC_FileProxy::runPreProxies('hash', $absolutePath) && OC_Filesystem::isValidPath($path)) {
+ $path = $this->getRelativePath($absolutePath);
+ if ($path == null) {
+ return false;
+ }
+ if (OC_Filesystem::$loaded && $this->fakeRoot == OC_Filesystem::getRoot()) {
+ OC_Hook::emit(
+ OC_Filesystem::CLASSNAME,
+ OC_Filesystem::signal_read,
+ array( OC_Filesystem::signal_param_path => $path)
+ );
+ }
+ if ($storage = $this->getStorage($path)) {
+ $result = $storage->hash($type, $this->getInternalPath($path), $raw);
+ $result = OC_FileProxy::runPostProxies('hash', $absolutePath, $result);
+ return $result;
+ }
+ }
+ return null;
}
public function free_space($path='/') {