fixed bugs report by Frank Becker on the german list and some more I

noticed while working on it:
- memory size error, when renaming a file after posting the list (eg.
  clicking on home icon)
- renaming (moving) one file on an existing filename, put the file in an
  inaccessible state
- renaming more then once, did not work
--> ToDo: add some ajax to notify the user, when he tries to overwrite
an other file while renaming one
This commit is contained in:
Ralf Becker 2008-07-27 18:58:41 +00:00
parent dc287964f7
commit 5b705e6bc6
2 changed files with 20 additions and 4 deletions

View File

@ -448,7 +448,6 @@ class filemanager_ui
{
$content['perms']['executable'] = (int)!!($content['mode'] & 0111);
$mask = 6;
$content['link'] = $GLOBALS['egw']->link(egw_vfs::download_url($path));
if (preg_match('/^text/',$content['mime']) && $content['size'] < 100000)
{
$content['text_content'] = file_get_contents(egw_vfs::PREFIX.$path);
@ -468,7 +467,7 @@ class filemanager_ui
else
{
//_debug_array($content);
$path = $content['path'];
$path =& $content['path'];
list($button) = @each($content['button']); unset($content['button']);
if (in_array($button,array('save','apply')))
@ -483,8 +482,13 @@ class filemanager_ui
if (egw_vfs::rename($path,$to = egw_vfs::concat($content['dir'],$content['name'])))
{
$msg .= lang('Renamed %1 to %2.',$path,$to).' ';
$content['old']['name'] = $content[$name];
$path = $to;
}
else
{
$msg .= lang('Rename of %1 to %2 failed!',$path,$to).' ';
}
$path = $to;
break;
default:
static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod');
@ -531,11 +535,16 @@ class filemanager_ui
}
}
// refresh opender and close our window
$js = "opener.location.href=opener.location.href+'&msg=".urlencode(addslashes($msg))."'; ";
$link = egw::link('/index.php',array(
'menuaction' => 'filemanager.filemanager_ui.index',
'msg' => $msg,
));
$js = "opener.location.href='".addslashes($link)."'; ";
if ($button == 'save') $js .= "window.close();";
echo "<html>\n<body>\n<script>\n$js\n</script>\n</body>\n</html>\n";
if ($button == 'save')$GLOBALS['egw']->common->egw_exit();
}
$content['link'] = $GLOBALS['egw']->link(egw_vfs::download_url($path));
$content['msg'] = $msg;
if (($readonlys['uid'] = !egw_vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root';

View File

@ -500,6 +500,13 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) $path_to is $is_dir directory!");
return false; // no permission or file does not exist
}
// if destination file already exists, delete it
if ($to_stat && !self::unlink($url_to,$operation))
{
self::_remove_password($url_to);
if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) can't unlink existing $url_to!");
return false;
}
$stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_dir=:fs_dir,fs_name=:fs_name WHERE fs_id=:fs_id');
if (($ret = $stmt->execute(array(
':fs_dir' => $to_dir_stat['ino'],