From 18f7749995c2fb4281839df8f8aa2b0a0c545260 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Mar 2009 05:42:03 -0800 Subject: run sms carrier script on install --- install.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'install.php') diff --git a/install.php b/install.php index 18fc362b6..3d76dace1 100644 --- a/install.php +++ b/install.php @@ -152,6 +152,13 @@ function handlePost() showForm(); return; } + updateStatus("Adding SMS carrier data to database..."); + $res = runDbScript(INSTALLDIR.'/db/sms_carrier.sql', $conn); + if ($res === false) { + updateStatus("Can't run SMS carrier script.", true); + showForm(); + return; + } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; $res = writeConf($sitename, $sqlUrl); -- cgit v1.2.3-54-g00ecf From 6070d98aa6ed53cfafa9f4bcc6ecd24977b8866a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 1 Mar 2009 10:12:16 -0800 Subject: check posted parameters --- install.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'install.php') diff --git a/install.php b/install.php index 3d76dace1..29d909417 100644 --- a/install.php +++ b/install.php @@ -130,6 +130,36 @@ function handlePost() $password = $_POST['password']; $sitename = $_POST['sitename']; + if (empty($host)) { + updateStatus("No hostname specified.", true); + showForm(); + return; + } + + if (empty($database)) { + updateStatus("No database specified.", true); + showForm(); + return; + } + + if (empty($username)) { + updateStatus("No username specified.", true); + showForm(); + return; + } + + if (empty($password)) { + updateStatus("No password specified.", true); + showForm(); + return; + } + + if (empty($sitename)) { + updateStatus("No sitename specified.", true); + showForm(); + return; + } + updateStatus("Starting installation..."); updateStatus("Checking database..."); $conn = mysql_connect($host, $username, $password); -- cgit v1.2.3-54-g00ecf From 07efccd7ef274f6d6f2b28781a87ec7271702a7f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Mar 2009 05:44:29 -0800 Subject: add notice source data on install --- install.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'install.php') diff --git a/install.php b/install.php index 29d909417..fbfd5e4d1 100644 --- a/install.php +++ b/install.php @@ -189,6 +189,13 @@ function handlePost() showForm(); return; } + updateStatus("Adding notice source data to database..."); + $res = runDbScript(INSTALLDIR.'/db/notice_source.sql', $conn); + if ($res === false) { + updateStatus("Can't run notice source script.", true); + showForm(); + return; + } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; $res = writeConf($sitename, $sqlUrl); -- cgit v1.2.3-54-g00ecf From 8d05768e2cfcc1a4534307ae9a3be333376d4cfe Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Mar 2009 05:47:37 -0800 Subject: run foreign services script --- install.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'install.php') diff --git a/install.php b/install.php index fbfd5e4d1..7aa8836c2 100644 --- a/install.php +++ b/install.php @@ -196,6 +196,13 @@ function handlePost() showForm(); return; } + updateStatus("Adding foreign service data to database..."); + $res = runDbScript(INSTALLDIR.'/db/foreign_services.sql', $conn); + if ($res === false) { + updateStatus("Can't run foreign service script.", true); + showForm(); + return; + } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; $res = writeConf($sitename, $sqlUrl); -- cgit v1.2.3-54-g00ecf From aa1bc6216e61faf5d5000f875f65b86bdb097c03 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 Mar 2009 05:53:04 -0800 Subject: Make a loop instead of repeating almost identical text in install --- install.php | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'install.php') diff --git a/install.php b/install.php index 7aa8836c2..0240349bb 100644 --- a/install.php +++ b/install.php @@ -182,26 +182,17 @@ function handlePost() showForm(); return; } - updateStatus("Adding SMS carrier data to database..."); - $res = runDbScript(INSTALLDIR.'/db/sms_carrier.sql', $conn); - if ($res === false) { - updateStatus("Can't run SMS carrier script.", true); - showForm(); - return; - } - updateStatus("Adding notice source data to database..."); - $res = runDbScript(INSTALLDIR.'/db/notice_source.sql', $conn); - if ($res === false) { - updateStatus("Can't run notice source script.", true); - showForm(); - return; - } - updateStatus("Adding foreign service data to database..."); - $res = runDbScript(INSTALLDIR.'/db/foreign_services.sql', $conn); - if ($res === false) { - updateStatus("Can't run foreign service script.", true); - showForm(); - return; + foreach (array('sms_carrier' => 'SMS carrier', + 'notice_source' => 'notice source', + 'foreign_services' => 'foreign service') + as $scr => $name) { + updateStatus(sprintf("Adding %s data to database...", $name)); + $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); + if ($res === false) { + updateStatus(sprintf("Can't run %d script.", $name), true); + showForm(); + return; + } } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; -- cgit v1.2.3-54-g00ecf