From 652e9b46636f6cedc4fedcd50f5a2d5f29eddb83 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Tue, 26 Mar 2019 10:41:34 +0000 Subject: [PATCH 1/4] update concept --- Modules/admin/admin_controller.php | 11 +-- Modules/admin/admin_main_view.php | 119 +++++++++++++++++++---------- 2 files changed, 86 insertions(+), 44 deletions(-) diff --git a/Modules/admin/admin_controller.php b/Modules/admin/admin_controller.php index 3c1443ba1..dbd60cee0 100644 --- a/Modules/admin/admin_controller.php +++ b/Modules/admin/admin_controller.php @@ -141,12 +141,13 @@ function read_file($file, $lines) { if ($route->subaction == 'update' && $session['write'] && $session['admin']) { $route->format = "text"; // Get update argument e.g. 'emonpi' or 'rfm69pi' - $argument=""; - if (isset($_POST['argument'])) { - $argument = $_POST['argument']; - } + $firmware=""; + if (isset($_POST['firmware'])) $firmware = $_POST['firmware']; + // Type: all, emoncms, firmware + $type=""; + if (isset($_POST['type'])) $type = $_POST['type']; - $redis->rpush("service-runner","$update_script $argument>$update_logfile"); + $redis->rpush("service-runner","$update_script $type $firmware>$update_logfile"); $result = "service-runner trigger sent"; } diff --git a/Modules/admin/admin_main_view.php b/Modules/admin/admin_main_view.php index fe51790d3..be5ee407c 100644 --- a/Modules/admin/admin_main_view.php +++ b/Modules/admin/admin_main_view.php @@ -211,18 +211,85 @@ function disk_list() + -

-

+

+


- + - + + + +

+

+

Release info: Emoncms

+ +
+ + + + + + +

+

+

Release info: emonPi | RFM69Pi

+ +
+
+
+ + + + + +

+

+ +
+ + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + +
Update All
OS, Packages, EmonHub, Emoncms & Firmware (if new version)
Update Firmware Only
Select your hardware type and firmware version
MySQL Database Only
Run this after a manual emoncms update, after installing a new module or to check emoncms database status.
+ + +

Change Logs: Emoncms | emonPi | RFM69Pi

+
+ + + + @@ -255,37 +322,7 @@ function disk_list()
- - - - - - - - - - - -
-

-

emonPi Update: updates emonPi firmware & Emoncms

-

emonBase Update: updates emonBase (RFM69Pi firmware) & Emoncms

-

Change Logs: Emoncms | emonPi | RFM69Pi

-

Caution: ensure RFM69Pi is populated with RFM69CW module not RFM12B before running RFM69Pi update: Identifying different RF Modules.

-

- -

-

-
- - - + @@ -592,8 +629,12 @@ function getLog() { var refresher_update; -$("#emonpiupdate").click(function() { - $.ajax({ type: "POST", url: path+"admin/emonpi/update", data: "argument=emonpi", async: true, success: function(result) +$(".update").click(function() { + + var type = $(this).attr("type"); + var firmware = $("#selected_firmware").val(); + + $.ajax({ type: "POST", url: path+"admin/emonpi/update", data: "type="+type+"&firmware="+firmware, async: true, success: function(result) { $("#update-log").html(result); $("#update-log-bound").scrollTop = $("#update-log-bound").scrollHeight; From 60bce81ab8a2f5f222769e895735f3695bd61741 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Thu, 28 Mar 2019 20:05:59 +0000 Subject: [PATCH 2/4] seperate emonhub update entry --- Modules/admin/admin_main_view.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Modules/admin/admin_main_view.php b/Modules/admin/admin_main_view.php index be5ee407c..590ec5b4d 100644 --- a/Modules/admin/admin_main_view.php +++ b/Modules/admin/admin_main_view.php @@ -224,8 +224,8 @@ function disk_list() -

-

+

+

Release info: Emoncms


@@ -233,6 +233,16 @@ function disk_list() + + +

+

Release info: EmonHub

+ +
+ + + +

From 6348bbc566a6c987fdb1e0240e06810142c95c77 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Tue, 2 Apr 2019 10:46:35 +0100 Subject: [PATCH 3/4] clean up of commented code --- Modules/admin/admin_main_view.php | 37 ++++--------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/Modules/admin/admin_main_view.php b/Modules/admin/admin_main_view.php index 590ec5b4d..172e60958 100644 --- a/Modules/admin/admin_main_view.php +++ b/Modules/admin/admin_main_view.php @@ -1,4 +1,4 @@ -admin/users" class="btn btn-info"> - + +

@@ -267,38 +268,8 @@ function disk_list() + - - - - - - - - - - -
-

- - - - - - - - - - - -
Update All
OS, Packages, EmonHub, Emoncms & Firmware (if new version)
Update Firmware Only
Select your hardware type and firmware version
MySQL Database Only
Run this after a manual emoncms update, after installing a new module or to check emoncms database status.
- - -

Change Logs: Emoncms | emonPi | RFM69Pi

-
- - - From 2825a63069f4f6cae469f922c673910e03f9e9d7 Mon Sep 17 00:00:00 2001 From: TrystanLea Date: Tue, 2 Apr 2019 10:56:16 +0100 Subject: [PATCH 4/4] check firmware and type params --- Modules/admin/admin_controller.php | 8 +++++--- Modules/admin/admin_main_view.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Modules/admin/admin_controller.php b/Modules/admin/admin_controller.php index dbd60cee0..e46e33608 100644 --- a/Modules/admin/admin_controller.php +++ b/Modules/admin/admin_controller.php @@ -14,7 +14,7 @@ function admin_controller() { - global $mysqli,$session,$route,$updatelogin,$allow_emonpi_admin, $log_filename, $log_enabled, $redis, $homedir; + global $mysqli,$session,$route,$updatelogin,$allow_emonpi_admin, $admin_show_update, $log_filename, $log_enabled, $redis, $homedir; $result = "

"._('Admin re-authentication required')."

"; // Allow for special admin session if updatelogin property is set to true in settings.php @@ -125,7 +125,7 @@ function read_file($file, $lines) { } } - else if ($allow_emonpi_admin && $route->action == 'emonpi') { + else if (($admin_show_update || $allow_emonpi_admin) && $route->action == 'emonpi') { //put $update_logfile here so it can be referenced in other if statements //before it was only accesable in the update subaction //placed some other variables here as well so they are grouped @@ -143,12 +143,14 @@ function read_file($file, $lines) { // Get update argument e.g. 'emonpi' or 'rfm69pi' $firmware=""; if (isset($_POST['firmware'])) $firmware = $_POST['firmware']; + if (!in_array($firmware,array("emonpi","rfm69pi","rfm12pi","custom"))) return "Invalid firmware type"; // Type: all, emoncms, firmware $type=""; if (isset($_POST['type'])) $type = $_POST['type']; + if (!in_array($type,array("all","emoncms","firmware","emonhub"))) return "Invalid update type"; $redis->rpush("service-runner","$update_script $type $firmware>$update_logfile"); - $result = "service-runner trigger sent"; + return "service-runner trigger sent"; } if ($route->subaction == 'getupdatelog' && $session['admin']) { diff --git a/Modules/admin/admin_main_view.php b/Modules/admin/admin_main_view.php index 172e60958..ca7be22cc 100644 --- a/Modules/admin/admin_main_view.php +++ b/Modules/admin/admin_main_view.php @@ -251,7 +251,7 @@ function disk_list()

Release info: emonPi | RFM69Pi


-
+