// Load the files
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
-if(!OC_Filesystem::is_dir($dir)) {
+if(!OC_Filesystem::is_dir($dir.'/')) {
header("Location: ".$_SERVER['PHP_SELF']."");
}
$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=?');
$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));
}
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);
* @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;
}
* @param string mountpoint
*/
static public function mount($class,$arguments,$mountpoint){
+ if(substr($mountpoint,-1)!=='/'){
+ $mountpoint=$mountpoint.'/';
+ }
if(substr($mountpoint,0,1)!=='/'){
$mountpoint='/'.$mountpoint;
}
$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;