diff --git a/config.php b/config.php index 7092926..e5a37e8 100644 --- a/config.php +++ b/config.php @@ -167,6 +167,10 @@ 'flag_build_as_broken' => array( 'title' => "Flag Build as Broken", 'success' => "" + ), + 'export_build_backup' => array( + 'title' => "Export Build Backup", + 'success' => "" ) ); diff --git a/includes/inc.panel.php b/includes/inc.panel.php index ade2f23..bc03639 100644 --- a/includes/inc.panel.php +++ b/includes/inc.panel.php @@ -923,3 +923,50 @@ function flag_build_as_broken() : void printf("

Flagged %d as broken.

", $pr); } + +function export_build_backup() : void +{ + $form = new HTMLForm("", "POST"); + $select = new HTMLSelect("os"); + $select->add_option(new HTMLOption("win", "Windows (x64)")); + $select->add_option(new HTMLOption("linux", "Linux (x64)")); + $select->add_option(new HTMLOption("mac", "macOS (x64)")); + $form->add_select($select); + $form->add_button(new HTMLButton("backupRequest", "submit", "Backup Request")); + $form->print(); + + if (!isset($_POST['os']) || !in_array($_POST['os'], array("win", "linux", "mac"))) + { + return; + } + + print("

"); + print("Save the following builds list to a text file and run command
"); + print("cat builds.txt | parallel --gnu \"wget -nc -nv --content-disposition --trust-server-names {}\"

"); + print("

"); + + $os = $_POST['os']; + + $url_prefix = "https://github.com/RPCS3/rpcs3-binaries-{$os}/releases/download/build-"; + + $db = getDatabase(); + + $q_builds = mysqli_query($db, "SELECT CONCAT('{$url_prefix}', `commit`, '/', `filename_{$os}`) AS `url` + FROM `builds` WHERE `filename_{$os}` IS NOT NULL AND `filename_{$os}` <> '' + ORDER BY `merge_datetime` DESC;"); + + mysqli_close($db); + + if (is_bool($q_builds)) + { + print("Error while fetching the builds list"); + return; + } + + print("

"); + while ($row = mysqli_fetch_object($q_builds)) + { + print($row->url."
"); + } + print("

"); +}