From 170d56cd420e9fc76543340636e98e315270bf06 Mon Sep 17 00:00:00 2001 From: Pecusx Date: Sat, 5 May 2018 13:02:41 +0200 Subject: [PATCH] Save and Restore configuration from web interface. --- html/config.php | 4 ++- html/sconfig.php | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 html/sconfig.php diff --git a/html/config.php b/html/config.php index 6e01831..3091c82 100755 --- a/html/config.php +++ b/html/config.php @@ -101,7 +101,7 @@ if ( $piradio_array['startup'] == 'PANDORA' ) { echo "Pandora radio\r\n"; echo "\r\n"; ?> - +
@@ -115,6 +115,8 @@ echo "Your PiRadio version: ".$local_version.". Last commit: ".date("d
 

+ +
Media network folder config
+ + + + + + PiRadio mini web interface - configuration backup and restore + + +PiRadio
+
+ 0) + { + echo "Error: " . $_FILES["file"]["error"] . "
"; + } else { + echo "File: "; + echo $_FILES["file"]["name"] ; + echo " loaded.
\r\n"; + move_uploaded_file($_FILES["file"]["tmp_name"], "/tmp/piradio.set"); + $tablica = explode('.', $_FILES["file"]["name"]); + $ostatni = count($tablica); + if($tablica[$ostatni-1] == 'set') { + $end = shell_exec('sudo ./scripts/restore_config.sh unpack'); + if (file_exists("/tmp/radiod/config/version")) { + echo "Setting new configuration.
\r\n"; + $end = shell_exec('sudo ./scripts/restore_config.sh apply'); + echo "O.K.
\r\n"; + $end = shell_exec('sudo ./scripts/reboot.sh'); + /* UWAGA! Folder z plikami uruchamianymi przez sudo + musi byc dopisany w pliku /etc/sudoers */ + echo "Reboot in progress.
\r\n"; + echo "Wait!
\r\n"; + echo "\r\n"; + } else { + echo "This is not PiRadio config file!!!
\r\n"; + echo "\r\n"; + } + } else { + unlink("/tmp/piradio.set"); + echo "This is wrong file!
\r\n"; + echo "\r\n"; + } + } +} else { + $end = shell_exec('sudo ./scripts/make_config_file.sh'); + echo "Backup PiRadio configuration
\r\n"; + echo "
\r\nClick the 'Backup' button to download the configuration backup file to your computer.\r\n
\r\n"; + echo ''; + echo "
\r\n"; + echo "Restore PiRadio configuration
\r\n"; + echo "
After restoringing the reboot will be performed!
\r\n"; + echo "\r\n"; + echo "
\r\n"; + echo " \r\n"; + echo "
\r\n"; + echo " \r\n"; + echo "
\r\n"; +} +?> +
+ + + + \ No newline at end of file