summaryrefslogtreecommitdiff
path: root/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'install.php')
-rw-r--r--install.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/install.php b/install.php
index 18fc362b6..0240349bb 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);
@@ -152,6 +182,18 @@ function handlePost()
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";
$res = writeConf($sitename, $sqlUrl);