Skip to content

Commit b9552e2

Browse files
author
Lutz Bender
committed
suggested changes
1 parent 2d0022e commit b9552e2

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

helperFunctions.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ openwbDebugLog() {
102102
export -f openwbDebugLog
103103

104104
openwbRunLoggingOutput() {
105-
functionName="$1"
106-
shift
107-
$functionName "$@" 2>&1 | while read -r line
105+
"$@" 2>&1 | while read -r line
108106
do
109107
# use path to /var/log as link in ramdisk may not be set up yet!
110108
echo "$(date +"%Y-%m-%d %H:%M:%S"): $1: $line" >> "/var/log/openWB.log"

runs/restore.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ LOGFILE="$OPENWBBASEDIR/web/tools/upload/restore.log"
2828
echo "****************************************"
2929
echo "Step 4: replacing old files..."
3030
# we use cp not mv because of not empty directories in destination
31-
# dotglob is needed to include files and directories beginning with a dot
32-
(shopt -s dotglob; sudo cp -v -p -r "${WORKINGDIR}${OPENWBBASEDIR}/"* "${OPENWBBASEDIR}/")
31+
sudo cp -v -p -r "${WORKINGDIR}${OPENWBBASEDIR}/." "${OPENWBBASEDIR}/"
3332
echo "****************************************"
3433
echo "Step 5: restoring mosquitto db..."
3534
if [[ -f "${WORKINGDIR}${MOSQUITTODIR}/mosquitto.db" ]]; then

web/settings/backup.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?php
22
// if parameter extendedFilename is passed with value 1 the filename changes
33
// from backup.tar.gz to openWB_backup_YYYY-MM-DD_HH-MM-SS.tar.gz
4-
$useExtendedFilename = 0;
5-
if( isset($_GET["extendedFilename"]) && $_GET["extendedFilename"] == "1") {
6-
$useExtendedFilename = 1;
7-
}
4+
$useExtendedFilename = isset($_GET["extendedFilename"]) && $_GET["extendedFilename"] == "1" ? 1 : 0;
5+
86
// execute backup script
97
$filename = exec("sudo -u pi " . $_SERVER['DOCUMENT_ROOT'] . "/openWB/runs/backup.sh " . $useExtendedFilename, $output, $result);
108
?>

web/settings/upload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function(data){
139139
</script>
140140
<?php
141141
if($uploadOk === true) {
142-
exec("sudo -u pi " . $_SERVER['DOCUMENT_ROOT'] . "/openWB/runs/restore.sh");
142+
exec("sudo -u pi " . escapeshellarg($_SERVER['DOCUMENT_ROOT']) . "/openWB/runs/restore.sh");
143143
?>
144144
<script>
145145
setTimeout(function() { window.location = "index.php"; }, 15000);

0 commit comments

Comments
 (0)