mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Added changes to finish rr feature. Ticket #169
This commit is contained in:
parent
22e81a0c2f
commit
584427de06
@ -156,6 +156,7 @@ ALTER TABLE trel_item ADD `id_map` int(11) NOT NULL DEFAULT 0;
|
|||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||||
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 0);
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tplanned_downtime_agents`
|
-- Table `tplanned_downtime_agents`
|
||||||
|
@ -79,6 +79,7 @@ UPDATE talert_commands SET fields_descriptions = '[\"Integria IMS API&
|
|||||||
INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO tconfig (token, value) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO tconfig (token, value) VALUES ('days_autodisable_deletion', '30');
|
||||||
|
INSERT INTO tconfig (token, value) VALUES ('MR', 0);
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tplanned_downtime_agents`
|
-- Table `tplanned_downtime_agents`
|
||||||
|
@ -26,22 +26,14 @@ if (! file_exists ($config["homedir"] . $license_file)) {
|
|||||||
$license_file = 'general/license/pandora_info_en.html';
|
$license_file = 'general/license/pandora_info_en.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$config["minor_release_open"]) {
|
if (!$config["MR"]) {
|
||||||
$config["minor_release_open"] = 0;
|
$config["MR"] = 0;
|
||||||
}
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
if (!$config["minor_release_enterprise"]) {
|
|
||||||
$config["minor_release_enterprise"] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
|
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
|
||||||
if (enterprise_installed()) {
|
|
||||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["minor_release_enterprise"]));
|
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["MR"]));
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo sprintf(__('Pandora FMS %s - Build %s - MR %s', $pandora_version, $build_version, $config["minor_release_open"]));
|
|
||||||
}
|
|
||||||
echo '</a><br />';
|
echo '</a><br />';
|
||||||
echo '<a class="white footer">'. __('Page generated at') . ' '. ui_print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here
|
echo '<a class="white footer">'. __('Page generated at') . ' '. ui_print_timestamp ($time, true, array ("prominent" => "timestamp")); //Always use timestamp here
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
|
@ -17,13 +17,14 @@ if (is_ajax ()) {
|
|||||||
global $config;
|
global $config;
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
$updare_rr_open = get_parameter('updare_rr_open', 0);
|
$updare_rr = get_parameter('updare_rr', 0);
|
||||||
|
|
||||||
if ($updare_rr_open) {
|
if ($updare_rr) {
|
||||||
$number = get_parameter('number');
|
$number = get_parameter('number');
|
||||||
|
|
||||||
$dir = $config["homedir"]."/extras/mr";
|
$dir = $config["homedir"]."/extras/mr";
|
||||||
|
|
||||||
$file = "$dir/$number.open.sql";
|
$file = "$dir/$number.sql";
|
||||||
|
|
||||||
$dangerous_query = false;
|
$dangerous_query = false;
|
||||||
$mr_file = fopen($file, "r");
|
$mr_file = fopen($file, "r");
|
||||||
@ -44,30 +45,29 @@ if (is_ajax ()) {
|
|||||||
else {
|
else {
|
||||||
if (file_exists($dir) && is_dir($dir)) {
|
if (file_exists($dir) && is_dir($dir)) {
|
||||||
if (is_readable($dir)) {
|
if (is_readable($dir)) {
|
||||||
if ($config["minor_release_open"] >= $number) {
|
if ($config["MR"] >= $number) {
|
||||||
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
||||||
mkdir($dir."/updated");
|
mkdir($dir."/updated");
|
||||||
}
|
}
|
||||||
$file_dest = "$dir/updated/$number.open.sql";
|
$file_dest = "$dir/updated/$number.sql";
|
||||||
if (copy($file, $file_dest)) {
|
if (copy($file, $file_dest)) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = db_run_sql_file($file);
|
$result = db_run_sql_file($file);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$update_config = update_config_token("minor_release_open", $number);
|
$update_config = update_config_token("MR", $number);
|
||||||
if ($update_config) {
|
if ($update_config) {
|
||||||
$config["minor_release_open"] = $number;
|
$config["MR"] = $number;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config["minor_release_open"] == $number) {
|
if ($config["MR"] == $number) {
|
||||||
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
if (!file_exists($dir."/updated") || !is_dir($dir."/updated")) {
|
||||||
mkdir($dir."/updated");
|
mkdir($dir."/updated");
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_dest = "$dir/updated/$number.open.sql";
|
$file_dest = "$dir/updated/$number.sql";
|
||||||
|
|
||||||
if (copy($file, $file_dest)) {
|
if (copy($file, $file_dest)) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
@ -56,21 +56,12 @@ $no_login_msg = "";
|
|||||||
// Don't change the format, it is parsed by applications
|
// Don't change the format, it is parsed by applications
|
||||||
switch($info) {
|
switch($info) {
|
||||||
case 'version':
|
case 'version':
|
||||||
if (!$config["minor_release_open"]) {
|
if (!$config["MR"]) {
|
||||||
$config["minor_release_open"] = 0;
|
$config["MR"] = 0;
|
||||||
}
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
if (!$config["minor_release_enterprise"]) {
|
|
||||||
$config["minor_release_enterprise"] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["MR"];
|
||||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_enterprise"];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["minor_release_open"];
|
|
||||||
}
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||||||
|
|
||||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||||
// If you want persistent connections change it to mysql_pconnect().
|
// If you want persistent connections change it to mysql_pconnect().
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
|
||||||
if (mysqli_connect_error() > 0) {
|
if (mysqli_connect_errno() > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
db_change_cache_id ($db, $host);
|
db_change_cache_id ($db, $host);
|
||||||
@ -1080,7 +1080,7 @@ function mysql_db_get_all_row_by_steps_sql($new = true, &$result, $sql = null) {
|
|||||||
function mysql_db_process_sql_begin() {
|
function mysql_db_process_sql_begin() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 0');
|
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 0');
|
||||||
mysqli_query ($config['dbconnection'], 'START TRANSACTION');
|
mysqli_query ($config['dbconnection'], 'START TRANSACTION');
|
||||||
}
|
}
|
||||||
@ -1096,7 +1096,7 @@ function mysql_db_process_sql_begin() {
|
|||||||
function mysql_db_process_sql_commit() {
|
function mysql_db_process_sql_commit() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
mysqli_query ($config['dbconnection'], 'COMMIT');
|
mysqli_query ($config['dbconnection'], 'COMMIT');
|
||||||
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
||||||
}
|
}
|
||||||
@ -1112,7 +1112,7 @@ function mysql_db_process_sql_commit() {
|
|||||||
function mysql_db_process_sql_rollback() {
|
function mysql_db_process_sql_rollback() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
mysqli_query ($config['dbconnection'], 'ROLLBACK ');
|
mysqli_query ($config['dbconnection'], 'ROLLBACK ');
|
||||||
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
mysqli_query ($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
||||||
}
|
}
|
||||||
@ -1144,7 +1144,7 @@ function mysql_safe_sql_string($string) {
|
|||||||
function mysql_db_get_last_error() {
|
function mysql_db_get_last_error() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
return mysqli_error();
|
return mysqli_error();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1188,7 +1188,7 @@ function mysql_get_system_time() {
|
|||||||
function mysql_db_get_type_field_table($table, $field) {
|
function mysql_db_get_type_field_table($table, $field) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
$result = mysqli_query($config['dbconnection'], 'SELECT parameters FROM ' . $table);
|
$result = mysqli_query($config['dbconnection'], 'SELECT parameters FROM ' . $table);
|
||||||
|
|
||||||
return mysqli_fetch_field_direct($result, $field);
|
return mysqli_fetch_field_direct($result, $field);
|
||||||
@ -1221,7 +1221,7 @@ function mysql_db_get_table_count($sql, $search_history_db = false) {
|
|||||||
|
|
||||||
// Connect to the history DB
|
// Connect to the history DB
|
||||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
$config['history_db_connection'] = mysqli_connect_db ($config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'], $config['history_db_port'], false);
|
$config['history_db_connection'] = mysqli_connect_db ($config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'], $config['history_db_port'], false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1272,7 +1272,7 @@ function mysql_db_process_file ($path, $handle_error = true) {
|
|||||||
$query .= $sql_line;
|
$query .= $sql_line;
|
||||||
|
|
||||||
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
||||||
if ($config["mysqli"] === true) {
|
if ($config["mysqli"]) {
|
||||||
$query_result = mysqli_query($config['dbconnection'], $query);
|
$query_result = mysqli_query($config['dbconnection'], $query);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1325,7 +1325,6 @@ function db_run_sql_file ($location) {
|
|||||||
|
|
||||||
// Load file
|
// Load file
|
||||||
$commands = file_get_contents($location);
|
$commands = file_get_contents($location);
|
||||||
|
|
||||||
// Delete comments
|
// Delete comments
|
||||||
$lines = explode("\n", $commands);
|
$lines = explode("\n", $commands);
|
||||||
$commands = '';
|
$commands = '';
|
||||||
@ -1339,23 +1338,51 @@ function db_run_sql_file ($location) {
|
|||||||
// Convert to array
|
// Convert to array
|
||||||
$commands = explode(";", $commands);
|
$commands = explode(";", $commands);
|
||||||
|
|
||||||
// Run commands
|
if ($config['mysqli']) {
|
||||||
mysql_db_process_sql_begin(); // Begin transaction
|
$mysqli = new mysqli($config["dbhost"], $config["dbuser"], $config["dbpass"], $config["dbname"], $config["dbport"]);
|
||||||
|
|
||||||
|
// Run commands
|
||||||
|
$mysqli->query($config['dbconnection'], 'SET AUTOCOMMIT = 0');
|
||||||
|
$mysqli->query($config['dbconnection'], 'START TRANSACTION');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Run commands
|
||||||
|
mysql_db_process_sql_begin(); // Begin transaction
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
if (trim($command)) {
|
if (trim($command)) {
|
||||||
$result = mysql_query($command);
|
if ($config['mysqli']) {
|
||||||
|
$result = $mysqli->query($command);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result = mysql_query($command);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
break; // Error
|
break; // Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
mysql_db_process_sql_commit(); // Save results
|
if ($config['mysqli']) {
|
||||||
|
$mysqli->query($config['dbconnection'], 'COMMIT');
|
||||||
|
$mysqli->query($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mysql_db_process_sql_commit(); // Save results
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mysql_db_process_sql_rollback(); // Undo results
|
if ($config['mysqli']) {
|
||||||
|
$mysqli->query($config['dbconnection'], 'ROLLBACK ');
|
||||||
|
$mysqli->query($config['dbconnection'], 'SET AUTOCOMMIT = 1');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mysql_db_process_sql_rollback(); // Undo results
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2681,17 +2681,7 @@ function update_config_token ($cfgtoken, $cfgvalue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_conf_minor_release() {
|
function get_number_of_mr() {
|
||||||
global $config;
|
|
||||||
|
|
||||||
$config['minor_release_open'] = db_get_value ('value', 'tconfig', 'token', 'minor_release_open');
|
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
$config['minor_release_enterprise'] = db_get_value ('value', 'tconfig', 'token', 'minor_release_enterprise');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_number_of_mr($mode) {
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$dir = $config["homedir"]."/extras/mr";
|
$dir = $config["homedir"]."/extras/mr";
|
||||||
@ -2699,37 +2689,17 @@ function get_number_of_mr($mode) {
|
|||||||
|
|
||||||
if (file_exists($dir) && is_dir($dir)) {
|
if (file_exists($dir) && is_dir($dir)) {
|
||||||
if (is_readable($dir)) {
|
if (is_readable($dir)) {
|
||||||
if ($mode == 'open') {
|
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
||||||
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
|
||||||
|
if ($files !== false) {
|
||||||
|
$pattern = "/^\d+\.sql$/";
|
||||||
|
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||||
|
$pattern = "/\.sql$/";
|
||||||
|
$replacement = "";
|
||||||
|
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles);
|
||||||
|
|
||||||
if ($files !== false) {
|
foreach ($sqlfiles_num as $num) {
|
||||||
$pattern = "/^\d+\.open\.sql$/";
|
$mr_size[] = $num;
|
||||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
|
||||||
$pattern = "/\.open\.sql$/";
|
|
||||||
$replacement = "";
|
|
||||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles);
|
|
||||||
|
|
||||||
foreach ($sqlfiles_num as $num) {
|
|
||||||
$mr_size[] = $num;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
$files2 = scandir($dir); // Get all the files from the directory ordered by asc
|
|
||||||
|
|
||||||
if ($files2 !== false) {
|
|
||||||
$pattern2 = "/^\d+\.ent\.sql$/";
|
|
||||||
$sqlfiles2 = preg_grep($pattern2, $files2); // Get the name of the correct files
|
|
||||||
|
|
||||||
$pattern2 = "/\.ent\.sql$/";
|
|
||||||
$replacement2 = "";
|
|
||||||
$sqlfiles_num2 = preg_replace($pattern2, $replacement2, $sqlfiles2); // Get the number of the file
|
|
||||||
|
|
||||||
foreach ($sqlfiles_num2 as $num2) {
|
|
||||||
$mr_size[] = $num2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1682,63 +1682,24 @@ function db_check_minor_relase_available () {
|
|||||||
|
|
||||||
$dir = $config["homedir"]."/extras/mr";
|
$dir = $config["homedir"]."/extras/mr";
|
||||||
|
|
||||||
$have_ent_minor = false;
|
$have_minor_release = false;
|
||||||
$have_open_minor = false;
|
|
||||||
|
|
||||||
if (file_exists($dir) && is_dir($dir)) {
|
if (file_exists($dir) && is_dir($dir)) {
|
||||||
if (is_readable($dir)) {
|
if (is_readable($dir)) {
|
||||||
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
$files = scandir($dir); // Get all the files from the directory ordered by asc
|
||||||
|
|
||||||
if ($files !== false) {
|
if ($files !== false) {
|
||||||
// Enterprise installed
|
$pattern = "/^\d+\.sql$/";
|
||||||
if (enterprise_installed()) {
|
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
||||||
$pattern = "/^\d+\.open\.sql$/";
|
$files = null;
|
||||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
$pattern = "/\.sql$/";
|
||||||
$pattern = "/\.open\.sql$/";
|
$replacement = "";
|
||||||
$replacement = "";
|
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
||||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
|
||||||
|
if ($sqlfiles_num) {
|
||||||
$sqlfiles = null;
|
foreach ($sqlfiles_num as $sqlfile_num) {
|
||||||
|
if ($config["MR"] < $sqlfile_num) {
|
||||||
if ($sqlfiles_num) {
|
$have_minor_release = true;
|
||||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
|
||||||
if ($config["minor_release_open"] < $sqlfile_num) {
|
|
||||||
$have_open_minor = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pattern2 = "/^\d+\.ent\.sql$/";
|
|
||||||
$sqlfiles2 = preg_grep($pattern2, $files); // Get the name of the correct files
|
|
||||||
$files = null;
|
|
||||||
$pattern2 = "/\.ent\.sql$/";
|
|
||||||
$replacement2 = "";
|
|
||||||
$sqlfiles_num2 = preg_replace($pattern2, $replacement2, $sqlfiles2); // Get the number of the file
|
|
||||||
|
|
||||||
$sqlfiles2 = null;
|
|
||||||
|
|
||||||
if ($sqlfiles_num2) {
|
|
||||||
foreach ($sqlfiles_num2 as $sqlfile_num2) {
|
|
||||||
if ($config["minor_release_enterprise"] < $sqlfile_num2) {
|
|
||||||
$have_ent_minor = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$pattern = "/^\d+\.open.sql$/";
|
|
||||||
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
|
|
||||||
$files = null;
|
|
||||||
$pattern = "/\.open.sql$/";
|
|
||||||
$replacement = "";
|
|
||||||
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
|
|
||||||
|
|
||||||
$sqlfiles = null;
|
|
||||||
|
|
||||||
if ($sqlfiles_num) {
|
|
||||||
foreach ($sqlfiles_num as $sqlfile_num) {
|
|
||||||
if ($config["minor_release"] < $sqlfile_num) {
|
|
||||||
$have_open_minor = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1746,7 +1707,7 @@ function db_check_minor_relase_available () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($have_open_minor || $have_ent_minor) {
|
if ($have_minor_release) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -469,8 +469,7 @@ if (! isset ($config['id_user'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($have_minor_releases) {
|
if ($have_minor_releases) {
|
||||||
$size_mr_o = get_number_of_mr('open');
|
$size_mr = get_number_of_mr();
|
||||||
$size_mr_e = get_number_of_mr('enterprise');
|
|
||||||
echo "<div class= 'dialog ui-dialog-content' title='".__("Minor release available")."' id='mr_dialog2'>" . __('') . "</div>";
|
echo "<div class= 'dialog ui-dialog-content' title='".__("Minor release available")."' id='mr_dialog2'>" . __('') . "</div>";
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
@ -486,17 +485,18 @@ if (! isset ($config['id_user'])) {
|
|||||||
width: 600,
|
width: 600,
|
||||||
height: 350,
|
height: 350,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Apply minor releases": function() {
|
"Apply minor releases": function () {
|
||||||
var n_mr_o = '<?php echo implode(",", $size_mr_o);?>';
|
var n_mr = '<?php echo implode(",", $size_mr);?>';
|
||||||
var n_mr_e = '<?php echo implode(",", $size_mr_e);?>';
|
apply_minor_release(n_mr.split(","));
|
||||||
$(this).dialog("close");
|
|
||||||
apply_minor_release(n_mr_o.split(","), n_mr_e.split(","));
|
|
||||||
},
|
},
|
||||||
Cancel: function() {
|
"Cancel": function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('button:contains(Apply minor releases)').attr("id","apply_rr_button");
|
||||||
|
$('button:contains(Cancel)').attr("id","cancel_rr_button");
|
||||||
|
|
||||||
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
var dialog_text = "<div><h3>Do you want to apply minor releases?</h3></br>";
|
||||||
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
dialog_text = dialog_text + "<h2>We recommend launch a planned downtime to this process</h2></br>";
|
||||||
@ -975,14 +975,18 @@ require('include/php_to_js_values.php');
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function apply_minor_release (n_mr_o, n_mr_e) {
|
function apply_minor_release (n_mr) {
|
||||||
var error = false;
|
var error = false;
|
||||||
$.each(n_mr_o, function(i, open_mr) {
|
$("#apply_rr_button").remove();
|
||||||
|
$("#cancel_rr_button").text("Close");
|
||||||
|
$('#mr_dialog2').empty();
|
||||||
|
$('#mr_dialog2').append("<img id=\"rr_image\" src=\"<?php echo $config['homeurl'] . 'images/spinner.gif'; ?>\">");
|
||||||
|
$.each(n_mr, function(i, mr) {
|
||||||
var params = {};
|
var params = {};
|
||||||
params["updare_rr_open"] = 1;
|
params["updare_rr"] = 1;
|
||||||
params["number"] = open_mr;
|
params["number"] = mr;
|
||||||
params["page"] = "include/ajax/rolling_release.ajax";
|
params["page"] = "include/ajax/rolling_release.ajax";
|
||||||
|
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: params,
|
data: params,
|
||||||
async: false,
|
async: false,
|
||||||
@ -991,44 +995,25 @@ require('include/php_to_js_values.php');
|
|||||||
url: "ajax.php",
|
url: "ajax.php",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data != "") {
|
if (data != "") {
|
||||||
alert("Error: " + data);
|
$('#mr_dialog2').empty();
|
||||||
|
$('#mr_dialog2').html("<h2>" + data + "</h2>");
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
});
|
$('#mr_dialog2').append("<p>- Applying DB MR #" + mr + "</p>");
|
||||||
|
|
||||||
if (error == true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var error2 = false;
|
|
||||||
$.each(n_mr_e, function(i, e_mr) {
|
|
||||||
var params = {};
|
|
||||||
params["updare_rr_enterprise"] = 1;
|
|
||||||
params["number"] = e_mr;
|
|
||||||
params["page"] = "enterprise/include/ajax/rolling_release.ajax";
|
|
||||||
|
|
||||||
jQuery.ajax ({
|
|
||||||
data: params,
|
|
||||||
async: false,
|
|
||||||
dataType: "html",
|
|
||||||
type: "POST",
|
|
||||||
url: "ajax.php",
|
|
||||||
success: function (data) {
|
|
||||||
if (data != "") {
|
|
||||||
alert("Error: " + data);
|
|
||||||
error2 = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error2 == true) {
|
if (error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!error && !error2) {
|
$('#rr_image').remove();
|
||||||
alert("Updated finished successfully");
|
|
||||||
|
if (!error) {
|
||||||
|
$('#mr_dialog2').append("<h2>Updated finished successfully</h2>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ INSERT INTO tconfig (token, value) VALUES ('custom_report_front_header', '');
|
|||||||
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_footer', '');
|
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_footer', '');
|
||||||
INSERT INTO tconfig (token, value) VALUES ('identification_reminder', 1);
|
INSERT INTO tconfig (token, value) VALUES ('identification_reminder', 1);
|
||||||
INSERT INTO tconfig (token, value) VALUES ('identification_reminder_timestamp', 0);
|
INSERT INTO tconfig (token, value) VALUES ('identification_reminder_timestamp', 0);
|
||||||
|
INSERT INTO tconfig (token, value) VALUES ('MR', 0);
|
||||||
INSERT INTO tconfig (token, value) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
INSERT INTO tconfig (token, value) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -109,7 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||||
('custom_report_front_header', ''),
|
('custom_report_front_header', ''),
|
||||||
('custom_report_front_footer', ''),
|
('custom_report_front_footer', ''),
|
||||||
('minor_release_open', 0),
|
('MR', 0),
|
||||||
('identification_reminder', 1),
|
('identification_reminder', 1),
|
||||||
('identification_reminder_timestamp', 0),
|
('identification_reminder_timestamp', 0),
|
||||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user