X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=install.php;h=87a99a650895b3774adc3b2e0c84cf401cb370fe;hb=b140bcdee4b1f4c8f2f34a89a9c5c51e7ecfe826;hp=3d76dace14d36835dd5fb86a3cf013af14339d38;hpb=18f7749995c2fb4281839df8f8aa2b0a0c545260;p=quix0rs-gnu-social.git diff --git a/install.php b/install.php index 3d76dace14..87a99a6508 100644 --- a/install.php +++ b/install.php @@ -1,4 +1,22 @@ - +. + */ + define('INSTALLDIR', dirname(__FILE__)); function main() @@ -19,12 +37,12 @@ function checkPrereqs() { if (file_exists(INSTALLDIR.'/config.php')) { ?>
Config file "config.php" already exists.
- +Require PHP version 5 or greater.
+ ?>Require PHP version 5 or greater.
Cannot load required extension "= $req ?>".
+ ?>Cannot load required extension "".
Cannot write config file to "= INSTALLDIR ?>".
+ ?>Cannot write config file to "".
On your server, try this command:
-chmod a+w = INSTALLDIR ?>- +
chmod a+w+
Cannot write avatar directory "= INSTALLDIR ?>/avatar/".
+ ?>Cannot write avatar directory "/avatar/".
On your server, try this command:
-chmod a+w = INSTALLDIR ?>/avatar/+
chmod a+w /avatar/return false; } @@ -130,6 +148,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,12 +200,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; + 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"; @@ -176,7 +229,7 @@ function handlePost() function writeConf($sitename, $sqlUrl) { $res = file_put_contents(INSTALLDIR.'/config.php', - "\n". + "