summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-04 05:53:04 -0800
committerEvan Prodromou <evan@controlyourself.ca>2009-03-04 05:53:04 -0800
commitaa1bc6216e61faf5d5000f875f65b86bdb097c03 (patch)
tree74af9ec7fd586d4a825a7496db82e82ba6d7d87f
parent8d05768e2cfcc1a4534307ae9a3be333376d4cfe (diff)
Make a loop instead of repeating almost identical text in install
-rw-r--r--install.php31
1 files changed, 11 insertions, 20 deletions
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";