Merge branch 'ent-3612_Update_manager_eliminar_archivos_obsoletos' into 'develop'
add delete files in update manager See merge request artica/pandorafms!2263 Former-commit-id: 13d246c80921f2d4b5ceb0b191d0024e8bba753c
This commit is contained in:
commit
49a28eb13c
|
@ -0,0 +1,3 @@
|
||||||
|
/godmode/servers/recorn_script.php
|
||||||
|
/godmode/servers/manage_recontask_form.php
|
||||||
|
/godmode/servers/manage_recontask.php
|
|
@ -1,23 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
|
* point to.
|
||||||
|
*
|
||||||
|
* @category Update Manager Offline
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// ui_require_css_file('update_manager', 'godmode/update_manager/');
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
// ui_require_css_file('update_manager', 'godmode/update_manager/');
|
if (! check_acl($config['id_user'], 0, 'PM')
|
||||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
&& ! is_user_admin($config['id_user'])
|
||||||
|
) {
|
||||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
||||||
include 'general/noaccess.php';
|
include 'general/noaccess.php';
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +43,8 @@ $baseurl = ui_get_full_url(false, false, false, false);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Add the stylesheet here cause somehow the 'ui_require_css_file' is not working on the metaconsole and there is no time to fix it -->
|
<!-- Add the stylesheet here cause somehow the 'ui_require_css_file'
|
||||||
|
is not working on the metaconsole and there is no time to fix it -->
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo $baseurl; ?>/godmode/update_manager/update_manager.css">
|
<link rel="stylesheet" type="text/css" href="<?php echo $baseurl; ?>/godmode/update_manager/update_manager.css">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -1,16 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
|
* point to.
|
||||||
|
*
|
||||||
|
* @category Update Manager Ajax
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
@ -44,6 +60,7 @@ $check_update_free_package = (bool) get_parameter('check_update_free_package');
|
||||||
$install_free_package = (bool) get_parameter('install_free_package');
|
$install_free_package = (bool) get_parameter('install_free_package');
|
||||||
$search_minor = (bool) get_parameter('search_minor');
|
$search_minor = (bool) get_parameter('search_minor');
|
||||||
$unzip_free_package = (bool) get_parameter('unzip_free_package');
|
$unzip_free_package = (bool) get_parameter('unzip_free_package');
|
||||||
|
$delete_desired_files = (bool) get_parameter('delete_desired_files');
|
||||||
|
|
||||||
if ($upload_file) {
|
if ($upload_file) {
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
@ -243,8 +260,15 @@ if ($install_package) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_manager_enterprise_set_version($version);
|
enterprise_hook(
|
||||||
db_pandora_audit('Update '.get_product_name(), "Update version: $version of ".get_product_name().' by '.$config['id_user']);
|
'update_manager_enterprise_set_version',
|
||||||
|
[$version]
|
||||||
|
);
|
||||||
|
|
||||||
|
db_pandora_audit(
|
||||||
|
'Update '.get_product_name(),
|
||||||
|
"Update version: $version of ".get_product_name().' by '.$config['id_user']
|
||||||
|
);
|
||||||
|
|
||||||
$return['status'] = 'success';
|
$return['status'] = 'success';
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
|
@ -591,3 +615,143 @@ if ($install_free_package) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Result info:
|
||||||
|
* Types of status:
|
||||||
|
* -1 -> Not exits file.
|
||||||
|
* 0 -> File or directory deleted successfully.
|
||||||
|
* 1 -> Problem delete file or directory.
|
||||||
|
* 2 -> Not found file or directory.
|
||||||
|
* 3 -> Don`t read file deleet_files.txt.
|
||||||
|
* 4 -> "deleted" folder could not be created.
|
||||||
|
* 5 -> "deleted" folder was created.
|
||||||
|
* 6 -> The "delete files" could not be the "delete" folder.
|
||||||
|
* 7 -> The "delete files" is moved to the "delete" folder.
|
||||||
|
* Type:
|
||||||
|
* f -> File
|
||||||
|
* d -> Dir.
|
||||||
|
* route: Path.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($delete_desired_files === true) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
// Initialize result.
|
||||||
|
$result = [];
|
||||||
|
$result['status_list'] = [];
|
||||||
|
|
||||||
|
// Flag exist folder "deleted".
|
||||||
|
$exist_deleted = true;
|
||||||
|
|
||||||
|
// Route delete_files.txt.
|
||||||
|
$route_delete_files = $config['homedir'];
|
||||||
|
$route_delete_files .= '/extras/delete_files/delete_files.txt';
|
||||||
|
|
||||||
|
// Route directory deleted.
|
||||||
|
$route_dir_deleted = $config['homedir'];
|
||||||
|
$route_dir_deleted .= '/extras/delete_files/deleted/';
|
||||||
|
|
||||||
|
// Check isset directory deleted
|
||||||
|
// if it does not exist, try to create it.
|
||||||
|
if (is_dir($route_dir_deleted) === false) {
|
||||||
|
$res_mkdir = mkdir($route_dir_deleted, 0777, true);
|
||||||
|
$res = [];
|
||||||
|
if ($res_mkdir !== true) {
|
||||||
|
$exist_deleted = false;
|
||||||
|
$res['status'] = 4;
|
||||||
|
} else {
|
||||||
|
$res['status'] = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res['type'] = 'd';
|
||||||
|
$res['path'] = $url_to_delete;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check isset delete_files.txt.
|
||||||
|
if (file_exists($route_delete_files) === true && $exist_deleted === true) {
|
||||||
|
// Open file.
|
||||||
|
$file_read = fopen($route_delete_files, 'r');
|
||||||
|
// Check if read delete_files.txt.
|
||||||
|
if ($file_read !== false) {
|
||||||
|
while ($file_to_delete = stream_get_line($file_read, 65535, "\n")) {
|
||||||
|
$file_to_delete = trim($file_to_delete);
|
||||||
|
$url_to_delete = $config['homedir'].'/'.$file_to_delete;
|
||||||
|
// Check is dir or file or not exists.
|
||||||
|
if (is_dir($url_to_delete) === true) {
|
||||||
|
$rmdir_recursive = rmdir_recursive(
|
||||||
|
$url_to_delete,
|
||||||
|
$result['status_list']
|
||||||
|
);
|
||||||
|
|
||||||
|
array_push(
|
||||||
|
$result['status_list'],
|
||||||
|
$rmdir_recursive
|
||||||
|
);
|
||||||
|
} else if (file_exists($url_to_delete) === true) {
|
||||||
|
$unlink = unlink($url_to_delete);
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = ($unlink === true) ? 0 : 1;
|
||||||
|
$res['type'] = 'f';
|
||||||
|
$res['path'] = $url_to_delete;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
} else {
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = 2;
|
||||||
|
$res['path'] = $url_to_delete;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = 3;
|
||||||
|
$res['path'] = $url_to_delete;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close file.
|
||||||
|
fclose($route_delete_files);
|
||||||
|
|
||||||
|
// Move delete_files.txt to dir extras/deleted/.
|
||||||
|
$count_scandir = count(scandir($route_dir_deleted));
|
||||||
|
$route_move = $route_dir_deleted.'/delete_files_'.$count_scandir.'.txt';
|
||||||
|
$res_rename = rename(
|
||||||
|
$route_delete_files,
|
||||||
|
$route_move
|
||||||
|
);
|
||||||
|
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = ($res_rename === true) ? 7 : 6;
|
||||||
|
$res['type'] = 'f';
|
||||||
|
$res['path'] = $route_move;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
} else {
|
||||||
|
if ($exist_deleted === true) {
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = -1;
|
||||||
|
array_push($result['status_list'], $res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Translation diccionary neccesary.
|
||||||
|
$result['translation'] = [
|
||||||
|
'title' => __('Delete files'),
|
||||||
|
'not_file' => __('The oum has no files to remove'),
|
||||||
|
'not_found' => __('Not found'),
|
||||||
|
'not_deleted' => __('Not deleted'),
|
||||||
|
'not_read' => __('The file delete_file.txt can not be read'),
|
||||||
|
'folder_deleted_f' => __('\'deleted\' folder could not be created'),
|
||||||
|
'folder_deleted_t' => __('\'deleted\' folder was created'),
|
||||||
|
'move_file_f' => __(
|
||||||
|
'The "delete files" could not be the "delete" folder'
|
||||||
|
),
|
||||||
|
'move_file_d' => __(
|
||||||
|
'The "delete files" is moved to the "delete" folder'
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
|
@ -1,20 +1,30 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU Lesser General Public License
|
|
||||||
// as published by the Free Software Foundation; version 2
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package Include
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
* @subpackage UI
|
* point to.
|
||||||
|
*
|
||||||
|
* @category Functions Update Manager
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -988,13 +998,61 @@ function update_manger_set_deleted_message($message_id)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$rollback = db_get_value('description', 'tupdate', 'svn_version', $message_id);
|
$rollback = db_get_value(
|
||||||
|
'description',
|
||||||
|
'tupdate',
|
||||||
|
'svn_version',
|
||||||
|
$message_id
|
||||||
|
);
|
||||||
$users_read = json_decode($rollback, true);
|
$users_read = json_decode($rollback, true);
|
||||||
$users_read[$config['id_user']] = 1;
|
$users_read[$config['id_user']] = 1;
|
||||||
|
|
||||||
$rollback = json_encode($users_read);
|
$rollback = json_encode($users_read);
|
||||||
db_process_sql_update('tupdate', ['description' => $rollback ], ['svn_version' => $message_id]);
|
db_process_sql_update(
|
||||||
|
'tupdate',
|
||||||
|
['description' => $rollback ],
|
||||||
|
['svn_version' => $message_id]
|
||||||
|
);
|
||||||
|
|
||||||
// Mark as read too
|
// Mark as read too.
|
||||||
update_manger_set_read_message($message_id, 1);
|
update_manger_set_read_message($message_id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function recursive delete directory.
|
||||||
|
*
|
||||||
|
* @param string $dir Directory to delete.
|
||||||
|
* @param array $result Array result state and message.
|
||||||
|
*
|
||||||
|
* @return array Return result array with status 0 valid or 1 false and
|
||||||
|
* type 'f' file and 'd' dir and route path file or directory.
|
||||||
|
*/
|
||||||
|
function rmdir_recursive(string $dir, array &$result)
|
||||||
|
{
|
||||||
|
foreach (scandir($dir) as $file) {
|
||||||
|
if ('.' === $file || '..' === $file) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_dir($dir.'/'.$file) === true) {
|
||||||
|
rmdir_recursive($dir.'/'.$file, $result);
|
||||||
|
} else {
|
||||||
|
$unlink = unlink($dir.'/'.$file);
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = ($unlink === true) ? 0 : 1;
|
||||||
|
$res['type'] = 'f';
|
||||||
|
$res['path'] = $dir.'/'.$file;
|
||||||
|
array_push($result, $res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rmdir = rmdir($dir);
|
||||||
|
$res = [];
|
||||||
|
$res['status'] = ($rmdir === true) ? 0 : 1;
|
||||||
|
$res['type'] = 'd';
|
||||||
|
$res['path'] = $dir;
|
||||||
|
array_push($result, $res);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/*
|
||||||
|
globals $, jQuery
|
||||||
|
*/
|
||||||
|
|
||||||
var correct_install_progress = true;
|
var correct_install_progress = true;
|
||||||
|
|
||||||
function form_upload(homeurl) {
|
function form_upload(homeurl) {
|
||||||
|
@ -1246,11 +1250,11 @@ function check_install_package(package, homeurl) {
|
||||||
data: parameters,
|
data: parameters,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// Print the updated files and take the scroll to the bottom
|
// Print the updated files and take the scroll to the bottom.
|
||||||
$("#log_zone").html(data.info);
|
$("#log_zone").append(data.info);
|
||||||
$("#log_zone").scrollTop($("#log_zone").prop("scrollHeight"));
|
$("#log_zone").scrollTop($("#log_zone").prop("scrollHeight"));
|
||||||
|
|
||||||
// Change the progress bar
|
// Change the progress bar.
|
||||||
if (
|
if (
|
||||||
$("#form-offline_update ul")
|
$("#form-offline_update ul")
|
||||||
.find("li")
|
.find("li")
|
||||||
|
@ -1271,14 +1275,19 @@ function check_install_package(package, homeurl) {
|
||||||
.trigger("change");
|
.trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The class loading is present until the update ends
|
// The class loading is present until the update ends.
|
||||||
var isInstalling = $("#form-offline_update ul")
|
var isInstalling = $("#form-offline_update ul")
|
||||||
.find("li")
|
.find("li")
|
||||||
.hasClass("loading");
|
.hasClass("loading");
|
||||||
if (data.progress < 100 && isInstalling) {
|
if (data.progress < 100 && isInstalling) {
|
||||||
// Recursive call to check the update status
|
// Recursive call to check the update status.
|
||||||
check_install_package(package, homeurl);
|
check_install_package(package, homeurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isInstalling) {
|
||||||
|
//Check if exist remove files.
|
||||||
|
delete_desired_files(homeurl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2290,3 +2299,107 @@ function remove_rr_file_to_extras(homeurl) {
|
||||||
success: function(data) {}
|
success: function(data) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function delete files desired and add extras/delete_files.txt.
|
||||||
|
*
|
||||||
|
* @param string homeurl Url.
|
||||||
|
*/
|
||||||
|
function delete_desired_files(homeurl) {
|
||||||
|
var home_url = typeof homeurl !== "undefined" ? homeurl + "/" : "";
|
||||||
|
|
||||||
|
var parameters = {
|
||||||
|
page: "include/ajax/update_manager.ajax",
|
||||||
|
delete_desired_files: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.ajax({
|
||||||
|
data: parameters,
|
||||||
|
type: "POST",
|
||||||
|
url: home_url + "ajax.php",
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
var translation = data.translation;
|
||||||
|
// Print the deleted files.
|
||||||
|
// Print title.
|
||||||
|
$("#log_zone").append(
|
||||||
|
"</br></br><span class='log_zone_line bolder';>" +
|
||||||
|
translation.title +
|
||||||
|
": </span></br></br>"
|
||||||
|
);
|
||||||
|
$.each(data.status_list, function(key, value) {
|
||||||
|
var log_zone_line_class = "log_zone_line ";
|
||||||
|
var msg = "";
|
||||||
|
switch (value.status) {
|
||||||
|
case -1:
|
||||||
|
//Not exits file.
|
||||||
|
msg = translation.not_file;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
//File or directory deleted successfully.
|
||||||
|
if (value.type === "f") {
|
||||||
|
log_zone_line_class += "";
|
||||||
|
} else {
|
||||||
|
log_zone_line_class += "bolder";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = value.path;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
//Problem delete file or directory.
|
||||||
|
if (value.type === "f") {
|
||||||
|
log_zone_line_class += "log_zone_line_error";
|
||||||
|
} else {
|
||||||
|
log_zone_line_class += "log_zone_line_error bolder";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = value.path + " ( " + translation.not_deleted + " ) ";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//Not found file or directory.
|
||||||
|
if (value.type === "f") {
|
||||||
|
log_zone_line_class += "log_zone_line_error";
|
||||||
|
} else {
|
||||||
|
log_zone_line_class += "log_zone_line_error bolder";
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = value.path + " ( " + translation.not_found + " ) ";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//Don`t read file deleet_files.txt.
|
||||||
|
log_zone_line_class += "log_zone_line_error bolder";
|
||||||
|
msg = translation.not_read;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//"deleted" folder could not be created.
|
||||||
|
log_zone_line_class += "log_zone_line_error bolder";
|
||||||
|
msg = value.path + " ( " + translation.folder_deleted_f + " ) ";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
//"deleted" folder was created.
|
||||||
|
log_zone_line_class += "bolder";
|
||||||
|
msg = translation.folder_deleted_t;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
//The "delete files" could not be the "delete" folder.
|
||||||
|
log_zone_line_class += "log_zone_line_error bolder";
|
||||||
|
msg = value.path + " ( " + translation.move_file_f + " ) ";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
//The "delete files" is moved to the "delete" folder.
|
||||||
|
log_zone_line_class += "bolder";
|
||||||
|
msg = translation.move_file_d;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// It can not come without state.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Print line.
|
||||||
|
$("#log_zone").append(
|
||||||
|
"<span class='" + log_zone_line_class + "' >" + msg + "</span><br>"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -3920,7 +3920,19 @@ div.simple_value > a > span.text p {
|
||||||
font-size: 18pt;
|
font-size: 18pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.log_zone_line {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.log_zone_line_error {
|
||||||
|
color: #fc4444;
|
||||||
|
}
|
||||||
|
|
||||||
/* global */
|
/* global */
|
||||||
|
.bolder {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
.readonly {
|
.readonly {
|
||||||
background-color: #dedede !important;
|
background-color: #dedede !important;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue