summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-03-03 18:02:07 +0100
committerRobin Appelman <icewind@owncloud.com>2012-03-03 21:23:35 +0100
commit2e365658c856e1dffd1ee748db40158fdda0edc3 (patch)
tree7b43b4a6057796fbc65a0dce9af13e062fb9497d /lib
parent4c45483ad3acd5b675e54893686f912a32f10a12 (diff)
downloadnextcloud-server-2e365658c856e1dffd1ee748db40158fdda0edc3.tar.gz
nextcloud-server-2e365658c856e1dffd1ee748db40158fdda0edc3.zip
better handeling of files that can behave like folder (e.g. archives)
Diffstat (limited to 'lib')
-rw-r--r--lib/filecache.php7
-rw-r--r--lib/filestorage/local.php2
-rw-r--r--lib/filesystem.php10
-rw-r--r--lib/filesystemview.php1
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/filecache.php b/lib/filecache.php
index 732160c216a..e94ae49c73a 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -323,10 +323,11 @@ class OC_FileCache{
$path=$params['path'];
$fullPath=$view->getRoot().$path;
$mimetype=$view->getMimeType($path);
+ $dir=$view->is_dir($path.'/');
//dont use self::get here, we don't want inifinte loops when a file has changed
$cachedSize=self::getCachedSize($path,$root);
$size=0;
- if($mimetype=='httpd/unix-directory'){
+ if($dir){
if(self::inCache($path,$root)){
$parent=self::getFileId($fullPath);
$query=OC_DB::prepare('SELECT size FROM *PREFIX*fscache WHERE parent=?');
@@ -465,13 +466,13 @@ class OC_FileCache{
$view=new OC_FilesystemView(($root=='/')?'':$root);
}
self::scanFile($path,$root);
- $dh=$view->opendir($path);
+ $dh=$view->opendir($path.'/');
$totalSize=0;
if($dh){
while (($filename = readdir($dh)) !== false) {
if($filename != '.' and $filename != '..'){
$file=$path.'/'.$filename;
- if($view->is_dir($file)){
+ if($view->is_dir($file.'/')){
if($eventSource){
$eventSource->send('scanning',array('file'=>$file,'count'=>$count));
}
diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php
index 8e07ce6025b..750a1fb36dd 100644
--- a/lib/filestorage/local.php
+++ b/lib/filestorage/local.php
@@ -21,7 +21,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
return opendir($this->datadir.$path);
}
public function is_dir($path){
- return (is_dir($this->datadir.$path) or substr($path,-1)=='/');
+ return @is_dir($this->datadir.$path);
}
public function is_file($path){
return is_file($this->datadir.$path);
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 5013b3968c5..12905d189f9 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -146,20 +146,15 @@ class OC_Filesystem{
* @return string
*/
static public function getMountPoint($path){
+ OC_Hook::emit(self::CLASSNAME,'get_mountpoint',array('path'=>$path));
if(!$path){
$path='/';
}
if(substr($path,0,1)!=='/'){
$path='/'.$path;
}
- if(substr($path,-1)!=='/'){
- $path=$path.'/';
- }
$foundMountPoint='';
foreach(OC_Filesystem::$mounts as $mountpoint=>$storage){
- if(substr($mountpoint,-1)!=='/'){
- $mountpoint=$mountpoint.'/';
- }
if($mountpoint==$path){
return $mountpoint;
}
@@ -259,6 +254,9 @@ class OC_Filesystem{
* @param string mountpoint
*/
static public function mount($class,$arguments,$mountpoint){
+ if(substr($mountpoint,-1)!=='/'){
+ $mountpoint=$mountpoint.'/';
+ }
if(substr($mountpoint,0,1)!=='/'){
$mountpoint='/'.$mountpoint;
}
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 2d54a676c8c..89e0385fe9c 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -205,6 +205,7 @@ class OC_FilesystemView {
$count=OC_Helper::streamCopy($data,$target);
$storage1=$this->getStorage($path1);
$storage1->unlink($this->getInternalPath($path1));
+ $result=$count>0;
}
OC_Hook::emit( OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, array( OC_Filesystem::signal_param_oldpath => $path1, OC_Filesystem::signal_param_newpath=>$path2));
return $result;