mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
FileManager move function + small bugfixes
This commit is contained in:
parent
7b924c0227
commit
4adbef4517
38 changed files with 563 additions and 566 deletions
|
@ -37,17 +37,29 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
case 'rename_file':
|
||||
$dir = $_REQUEST['dir'];
|
||||
$item = $_REQUEST['item'];
|
||||
$target_name = $_REQUEST['target_name'];
|
||||
print json_encode($fm->renameFile($dir, $item, $target_name));
|
||||
$item = $dir . '/' . $_REQUEST['item'];
|
||||
$target_name = $dir . '/' . $_REQUEST['target_name'];
|
||||
print json_encode($fm->renameFile($item, $target_name));
|
||||
break;
|
||||
|
||||
case 'rename_directory':
|
||||
$dir = $_REQUEST['dir'];
|
||||
$item = $dir.$_REQUEST['item'];
|
||||
$target_name = $dir.$_REQUEST['target_name'];
|
||||
|
||||
print json_encode($fm->renameDirectory($item, $target_name));
|
||||
break;
|
||||
|
||||
case 'move_file':
|
||||
$item = $_REQUEST['item'];
|
||||
$target_name = $_REQUEST['target_name'];
|
||||
print json_encode($fm->renameFile($item, $target_name));
|
||||
break;
|
||||
|
||||
print json_encode($fm->renameDirectory($dir, $item, $target_name));
|
||||
case 'move_directory':
|
||||
$item = $_REQUEST['item'];
|
||||
$target_name = $_REQUEST['target_name'];
|
||||
print json_encode($fm->renameDirectory($item, $target_name));
|
||||
break;
|
||||
|
||||
case 'delete_files':
|
||||
|
@ -98,11 +110,9 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
|
||||
case 'pack_item':
|
||||
$dir = $_REQUEST['dir'];
|
||||
$target_dir = $_REQUEST['dir_target'];
|
||||
$filename = $_REQUEST['filename'];
|
||||
$item = $_REQUEST['item'];
|
||||
print json_encode($fm->packItem($item, $dir, $target_dir, $filename));
|
||||
$items = $_REQUEST['items'];
|
||||
$dst_item = $_REQUEST['dst_item'];
|
||||
print json_encode($fm->packItem($items, $dst_item));
|
||||
break;
|
||||
|
||||
case 'backup':
|
||||
|
|
|
@ -150,13 +150,18 @@ class FileManager {
|
|||
}
|
||||
}
|
||||
|
||||
function packItem($item, $dir, $target_dir, $filename) {
|
||||
$item = $this->formatFullPath($item);
|
||||
$dst_item = $this->formatFullPath($target_dir);
|
||||
function packItem($items, $dst_item) {
|
||||
$items_arr = explode(',', $items);
|
||||
foreach($items_arr as $key => $item){
|
||||
$items_arr[$key] = $this->formatFullPath($item);
|
||||
}
|
||||
$items = implode(' ', $items_arr);
|
||||
|
||||
$dst_item = $this->formatFullPath($dst_item);
|
||||
$dst_item = str_replace('.tar.gz', '', $dst_item);
|
||||
|
||||
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$item}", $output, $return_var);
|
||||
// echo VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$items}";
|
||||
exec (VESTA_CMD . "v-add-fs-archive {$this->user} {$dst_item} {$items}", $output, $return_var);
|
||||
|
||||
$error = self::check_return_code($return_var, $output);
|
||||
|
||||
|
@ -233,9 +238,12 @@ class FileManager {
|
|||
}
|
||||
}
|
||||
|
||||
function renameFile($dir, $item, $target_name) {
|
||||
$item = $this->formatFullPath($dir . '/' . $item);
|
||||
$dst_item = $this->formatFullPath($dir . '/' . $target_name);
|
||||
function renameFile($item, $target_name) {
|
||||
// $item = $this->formatFullPath($dir . '/' . $item);
|
||||
// $dst_item = $this->formatFullPath($dir . '/' . $target_name);
|
||||
|
||||
$item = $this->formatFullPath($item);
|
||||
$dst_item = $this->formatFullPath($target_name);
|
||||
|
||||
exec (VESTA_CMD . "v-move-fs-file {$this->user} {$item} {$dst_item}", $output, $return_var);
|
||||
|
||||
|
@ -254,9 +262,9 @@ class FileManager {
|
|||
}
|
||||
}
|
||||
|
||||
function renameDirectory($dir, $item, $target_name) {
|
||||
$item = $this->formatFullPath($dir . $item);
|
||||
$dst_item = $this->formatFullPath($dir . $target_name);
|
||||
function renameDirectory($item, $target_name) {
|
||||
$item = $this->formatFullPath($item);
|
||||
$dst_item = $this->formatFullPath($target_name);
|
||||
|
||||
if ($item == $dst_item) {
|
||||
return array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue