Skip to content

Commit

Permalink
Copy prod config to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Nov 28, 2023
1 parent 405326c commit 008d49a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/include/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

if (isset($_GET['action'])) {

if ($_GET['action'] != 'dlLog') {
if (!in_array($_GET['action'], ['dlLog', 'copyConfigFromProd'])) {
header('Content-Type: application/json; charset=utf-8');
}

Expand Down Expand Up @@ -140,6 +140,14 @@

break;

case 'copyConfigFromProd':
if (file_exists("/boot/config/plugins/appdata.backup/config.json")) {
copy("/boot/config/plugins/appdata.backup/config.json", "/boot/config/plugins/appdata.backup.beta/config.json");
echo "Config found and copied!";
} else {
echo "No productive config found :/";
}
break;

}
}
3 changes: 3 additions & 0 deletions src/pages/AB.Beta.Settings.page
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Tag="icon-archive"
---
<div class="title"><span class="left"><i class="fa fa-exclamation title"></i>BETA VERSION!!!</span></div>
<p style="color: red">This is a beta version! Please be aware of this!</p>
<p>In beta you can always copy/reset from the prod config from the stable version. To do so <a href="javascript:;"
onclick="copyConfigFromProd()">Click
here</a></p>
<?php
include('/usr/local/emhttp/plugins/appdata.backup.beta/pages/content/settings.php');
?>
9 changes: 9 additions & 0 deletions src/pages/content/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,4 +819,13 @@ function checkFlashBackupCopy() {
break;
}
}

function copyConfigFromProd() {
$.ajax(url + '?action=copyConfigFromProd').done(function (data) {
alert(data);
window.location.href = window.location;
}).fail(function (data) {
alert('Something went wrong :/')
});
}
</script>

0 comments on commit 008d49a

Please sign in to comment.