aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/process.php')
-rw-r--r--web/process.php61
1 files changed, 31 insertions, 30 deletions
diff --git a/web/process.php b/web/process.php
index 1b68d03..93c5d68 100644
--- a/web/process.php
+++ b/web/process.php
@@ -1,46 +1,47 @@
<?php
- $build_id = uniqid();
- $boot_megabytes = intval($_POST["boot_size"]);
- $swap_megabytes = intval($_POST["swap_size"]);
- $root_megabytes = intval($_POST["root_size"]);
- $timezone = escapeshellarg($_POST["timezone"]);
- $hostname = escapeshellarg($_POST["hostname"]);
- $username = escapeshellarg($_POST["username"]);
- $password = escapeshellarg($_POST["password"]);
- $root_password = escapeshellarg($_POST["rootpassword"]);
- $packages_list = escapeshellarg($_POST["packages"]);
- $output_format = escapeshellarg($_POST["format"]);
+ $buildID = uniqid();
+ $bootMegabytes = intval($_POST["boot_size"]);
+ $swapMegabytes = intval($_POST["swap_size"]);
+ $rootMegabytes = intval($_POST["root_size"]);
+ $timezone = escapeshellarg($_POST["timezone"]);
+ $hostname = escapeshellarg($_POST["hostname"]);
+ $username = escapeshellarg($_POST["username"]);
+ $password = escapeshellarg($_POST["password"]);
+ $rootPassword = escapeshellarg($_POST["rootpassword"]);
+ $packagesList = escapeshellarg($_POST["packages"]);
+ $outputFormat = escapeshellarg($_POST["format"]);
- $packages_list = str_replace("\r\n", " ", $packages_list);
- $packages_list = str_replace("\n", " ", $packages_list);
+ $packagesList = str_replace("\r\n", " ", $packagesList);
+ $packagesList = str_replace("\n", " ", $packagesList);
-$ini_string = "[vmconfig]
+$iniString = "[vmconfig]
-BUILD_ID='$build_id'
-BOOT_MEGABYTES='$boot_megabytes'
-SWAP_MEGABYTES='$swap_megabytes'
-ROOT_MEGABYTES='$root_megabytes'
+BUILD_ID='$buildID'
+BOOT_MEGABYTES='$bootMegabytes'
+SWAP_MEGABYTES='$swapMegabytes'
+ROOT_MEGABYTES='$rootMegabytes'
TIMEZONE=$timezone
HOSTNAME=$hostname
-ROOT_PASSWORD=$root_password
+ROOT_PASSWORD=$rootPassword
DEFAULT_USERNAME=$username
DEFAULT_PASSWORD=$password
USE_FLAGS=''
PACKAGE_USE=''
FEATURES='parallel-fetch userfetch userpriv getbinpkg'
PACKAGE_ACCEPT_KEYWORDS=''
-PACKAGES_LIST=$packages_list
-OUTPUT_FORMAT=$output_format";
+PACKAGES_LIST=$packagesList
+OUTPUT_FORMAT=$outputFormat";
- $client = new GearmanClient();
- $client->addServer();
- $handle = $client->doBackground("invoke_image_build", $ini_string);
+ $client = new GearmanClient();
+ $client->addServer();
+ $handle = $client->doBackground("invoke_image_build", $iniString);
- $db = mysql_connect("localhost","gentoaster","");
- if(!$db) die("Could not connect to database ".mysql_error());
- mysql_select_db("gentoaster");
- mysql_query("INSERT INTO builds (id, handle) VALUES('".$build_id."','".$handle."')");
+ $db = mysql_connect("localhost", "gentoaster", "");
+ if(!$db) die("Could not connect to database ".mysql_error());
+ mysql_select_db("gentoaster");
+ $query = "INSERT INTO builds (id, handle) ".
+ "VALUES('".$buildID."','".$handle."')";
+ mysql_query($query);
- header("Location: finished.php?uuid=".$build_id);
-?>
+ header("Location: finished.php?uuid=".$buildID); \ No newline at end of file