From ab08769adb800c65b60809b76ff29266a5cb559f Mon Sep 17 00:00:00 2001
From: digital-gnome <31593470+digital-gnome@users.noreply.github.com>
Date: Mon, 4 Dec 2017 14:48:17 -0500
Subject: [PATCH 2/4] Add nice to archive commands
Archiving could hammer io/cpu on the server. Big archives would cause problems.
---
web/skins/classic/includes/export_functions.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/web/skins/classic/includes/export_functions.php b/web/skins/classic/includes/export_functions.php
index 604dcba4e..f384594da 100644
--- a/web/skins/classic/includes/export_functions.php
+++ b/web/skins/classic/includes/export_functions.php
@@ -908,9 +908,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".tar.gz";
@unlink( $archive );
if ($exportStructure == 'flat') { //strip file paths if we choose
- $command = "tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile)." --xform='s#^.+/##x'";
+ $command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile)." --xform='s#^.+/##x'";
} else {
- $command = "tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile);
+ $command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile);
}
exec( $command, $output, $status );
if ( $status )
@@ -926,9 +926,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".zip";
@unlink( $archive );
if ($exportStructure == 'flat') {
- $command = "cat ".escapeshellarg($listFile)." | zip -q -j ".escapeshellarg($archive)." -@";
+ $command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q -j ".escapeshellarg($archive)." -@";
} else {
- $command = "cat ".escapeshellarg($listFile)." | zip -q ".escapeshellarg($archive)." -@";
+ $command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q ".escapeshellarg($archive)." -@";
}
//cat zmFileList.txt | zip -q zm_export.zip -@
//-bash: zip: command not found
From c72b1f3acf8f001fe08c17a29c87013b18578964 Mon Sep 17 00:00:00 2001
From: digital-gnome <31593470+digital-gnome@users.noreply.github.com>
Date: Mon, 4 Dec 2017 17:04:53 -0500
Subject: [PATCH 3/4] Fix refreshParent on some popups
Some popups wouldn't refresh the parent because after submit the none view page does not include jquery. This angers javascript and prevents the close function from working. Only fire header refresh code if there is a view.
---
web/skins/classic/js/skin.js | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js
index b9afd8503..97041bd65 100644
--- a/web/skins/classic/js/skin.js
+++ b/web/skins/classic/js/skin.js
@@ -182,18 +182,20 @@ function refreshParentWindow() {
}
}
-$j.ajaxSetup ({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
+if (currentView !='none') {
+ $j.ajaxSetup ({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
-$j(document).ready(function() {
- if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh)
-});
+ $j(document).ready(function() {
+ if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh)
+ });
-function getNavBar () {
- $j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar);
-}
+ function getNavBar () {
+ $j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar);
+ }
-function setNavBar (data) {
- $j('#reload').replaceWith(data.message);
+ function setNavBar (data) {
+ $j('#reload').replaceWith(data.message);
+ }
}
//Shows a message if there is an error in the streamObj or the stream doesn't exist. Returns true if error, false otherwise.
From 4f40b0464cce1248affa79ce4a60d20c9d5fda52 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Mon, 4 Dec 2017 17:11:16 -0500
Subject: [PATCH 4/4] Don't remove MonitorIds column.. just to support
downgrading
---
db/zm_update-1.31.16.sql | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/db/zm_update-1.31.16.sql b/db/zm_update-1.31.16.sql
index eedd60119..26cdfe317 100644
--- a/db/zm_update-1.31.16.sql
+++ b/db/zm_update-1.31.16.sql
@@ -80,7 +80,7 @@ SET @s = (SELECT IF(
"REPLACE INTO Groups_Monitors (GroupId,MonitorId) SELECT Id,SUBSTRING_INDEX(SUBSTRING_INDEX(t.MonitorIds, ',', n.n), ',', -1) value FROM Groups t CROSS JOIN ( SELECT a.N + b.N * 10 + 1 n FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a ,(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b ORDER BY n ) n WHERE t.MonitorIds != '' AND n.n <= 1 + (LENGTH(t.MonitorIds) - LENGTH(REPLACE(t.MonitorIds, ',', ''))) ORDER BY value;",
"SELECT 'MonitorIds has already been removed.'"
));
-
+/*
PREPARE stmt FROM @s;
EXECUTE stmt;
SET @s = (SELECT IF(
@@ -93,3 +93,4 @@ SET @s = (SELECT IF(
));
PREPARE stmt FROM @s;
EXECUTE stmt;
+*/