lots of installer improvements
This commit is contained in:
parent
b85387208e
commit
3a8269baf3
144
install.php
144
install.php
@ -1,36 +1,24 @@
|
|||||||
<?php ob_start(); ?>
|
<?php ob_start(); ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html>
|
||||||
<!--
|
<!--
|
||||||
- install.php (c) Shish et all. 2007-2012
|
- install.php (c) Shish et all. 2007-2012
|
||||||
-
|
-
|
||||||
- Initialise the database, check that folder
|
- Initialise the database, check that folder
|
||||||
- permissions are set properly, set an admin
|
- permissions are set properly.
|
||||||
- account.
|
|
||||||
-
|
-
|
||||||
- This file should be independant of the database
|
- This file should be independant of the database
|
||||||
- and other such things that aren't ready yet
|
- and other such things that aren't ready yet
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<title>Shimmie Installation</title>
|
<title>Shimmie Installation</title>
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="favicon.ico" />
|
||||||
<link rel='stylesheet' href='lib/shimmie.css' type='text/css'>
|
<link rel='stylesheet' href='lib/shimmie.css' type='text/css'>
|
||||||
<style type="text/css">
|
<script src="lib/jquery-1.7.1.min.js"></script>
|
||||||
BODY {background: #EEE;font-family: "Arial", sans-serif;font-size: 14px;}
|
|
||||||
H1, H3 {border: 1px solid black;background: #DDD;text-align: center;}
|
|
||||||
H1 {margin-top: 0px;margin-bottom: 0px;padding: 2px;}
|
|
||||||
H3 {margin-top: 32px;padding: 1px;}
|
|
||||||
FORM {margin: 0px;}
|
|
||||||
A {text-decoration: none;}
|
|
||||||
A:hover {text-decoration: underline;}
|
|
||||||
#block {width: 512px; margin: auto; margin-top: 64px;}
|
|
||||||
#iblock {width: 512px; margin: auto; margin-top: 16px;}
|
|
||||||
TD INPUT {width: 350px;}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php if(false) { ?>
|
<?php if(false) { ?>
|
||||||
<div id="block">
|
<div id="installer">
|
||||||
<h1>Install Error</h1>
|
<h1>Install Error</h1>
|
||||||
<p>Shimmie needs to be run via a web server with PHP support -- you
|
<p>Shimmie needs to be run via a web server with PHP support -- you
|
||||||
appear to be either opening the file from your hard disk, or your
|
appear to be either opening the file from your hard disk, or your
|
||||||
@ -112,64 +100,64 @@ function eok($name, $value) {
|
|||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
function do_install() { // {{{
|
function do_install() { // {{{
|
||||||
if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
|
if(file_exists("data/config/auto_install.conf.php")) {
|
||||||
$database_dsn = "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}";
|
require_once "data/config/auto_install.conf.php";
|
||||||
define('DATABASE_DSN', $database_dsn);
|
|
||||||
install_process();
|
install_process();
|
||||||
}
|
}
|
||||||
else if(file_exists("auto_install.conf")) {
|
else if(@$_POST["database_type"] == "sqlite" && isset($_POST["database_name"])) {
|
||||||
define('DATABASE_DSN', trim(file_get_contents("auto_install.conf")));
|
define('DATABASE_DSN', "sqlite:{$_POST["database_name"]}");
|
||||||
|
install_process();
|
||||||
|
}
|
||||||
|
else if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
|
||||||
|
define('DATABASE_DSN', "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}");
|
||||||
install_process();
|
install_process();
|
||||||
unlink("auto_install.conf");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
begin();
|
ask_questions();
|
||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
function begin() { // {{{
|
function ask_questions() { // {{{
|
||||||
$err = "";
|
$warnings = array();
|
||||||
$thumberr = "";
|
$errors = array();
|
||||||
$dberr = "";
|
|
||||||
|
|
||||||
if(check_gd_version() == 0 && check_im_version() == 0) {
|
if(check_gd_version() == 0 && check_im_version() == 0) {
|
||||||
$thumberr = "
|
$errors[] = "
|
||||||
<p>PHP's GD extension seems to be missing,
|
No thumbnailers cound be found - install the imagemagick
|
||||||
and imagemagick's \"convert\" command cannot be found -
|
tools (or the PHP-GD library, of imagemagick is unavailable).
|
||||||
no thumbnailing engines are available.
|
";
|
||||||
|
}
|
||||||
|
else if(check_im_version() == 0) {
|
||||||
|
$warnings[] = "
|
||||||
|
The 'convert' command (from the imagemagick package)
|
||||||
|
could not be found - PHP-GD can be used instead, but
|
||||||
|
the size of thumbnails will be limited.
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!function_exists("mysql_connect")) {
|
if(
|
||||||
$dberr = "
|
!function_exists("mysql_connect") &&
|
||||||
<p>PHP's MySQL extension seems to be missing; you may
|
!function_exists("pg_connect") &&
|
||||||
be able to use an unofficial alternative, checking
|
!function_exists("sqlite_open")
|
||||||
for libraries...
|
) {
|
||||||
|
$errors[] = "
|
||||||
|
No database connection library could be found; shimmie needs
|
||||||
|
php-pgsql, php-mysql, or php-sqlite
|
||||||
";
|
";
|
||||||
if(!function_exists("pg_connect")) {
|
|
||||||
$dberr .= "<br>PgSQL is missing";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$dberr .= "<br>PgSQL is available";
|
|
||||||
}
|
|
||||||
if(!function_exists("sqlite_open")) {
|
|
||||||
$dberr .= "<br>SQLite is missing";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$dberr .= "<br>SQLite is available";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($thumberr || $dberr) {
|
$db_m = function_exists("mysql_connect") ? '<option value="mysql">MySQL</option>' : "";
|
||||||
$err = "<h3>Error</h3>";
|
$db_p = function_exists("pg_connect") ? '<option value="pgsql">PostgreSQL</option>' : "";
|
||||||
}
|
$db_s = function_exists("sqlite_open") ? '<option value="sqlite">SQLite</option>' : "";
|
||||||
|
|
||||||
|
$warn_msg = $warnings ? "<h3>Warnings</h3>".implode("\n<br>", $warnings) : "";
|
||||||
|
$err_msg = $errors ? "<h3>Errors</h3>".implode("\n<br>", $errors) : "";
|
||||||
|
|
||||||
print <<<EOD
|
print <<<EOD
|
||||||
<div id="iblock">
|
<div id="installer">
|
||||||
<h1>Shimmie Installer</h1>
|
<h1>Shimmie Installer</h1>
|
||||||
|
|
||||||
$err
|
$warn_msg
|
||||||
$thumberr
|
$err_msg
|
||||||
$dberr
|
|
||||||
|
|
||||||
<h3>Database Install</h3>
|
<h3>Database Install</h3>
|
||||||
<form action="install.php" method="POST">
|
<form action="install.php" method="POST">
|
||||||
@ -177,37 +165,53 @@ function begin() { // {{{
|
|||||||
<table class='form'>
|
<table class='form'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type:</th>
|
<th>Type:</th>
|
||||||
<td><select name="database_type">
|
<td><select name="database_type" id="database_type" onchange="update_qs();">
|
||||||
<option value="mysql" selected>MySQL</option>
|
$db_m
|
||||||
<option value="pgsql">PostgreSQL</option>
|
$db_p
|
||||||
<option value="sqlite">SQLite</option>
|
$db_s
|
||||||
</td>
|
</select></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="dbconf mysql pgsql">
|
||||||
<th>Host:</th>
|
<th>Host:</th>
|
||||||
<td><input type="text" name="database_host" size="40" value="localhost"></td>
|
<td><input type="text" name="database_host" size="40" value="localhost"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="dbconf mysql pgsql">
|
||||||
<th>Username:</th>
|
<th>Username:</th>
|
||||||
<td><input type="text" name="database_user" size="40"></td>
|
<td><input type="text" name="database_user" size="40"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="dbconf mysql pgsql">
|
||||||
<th>Password:</th>
|
<th>Password:</th>
|
||||||
<td><input type="password" name="database_password" size="40"></td>
|
<td><input type="password" name="database_password" size="40"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="dbconf mysql pgsql sqlite">
|
||||||
<th>DB Name:</th>
|
<th>DB Name:</th>
|
||||||
<td><input type="text" name="database_name" size="40" value="shimmie"></td>
|
<td><input type="text" name="database_name" size="40" value="shimmie"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="2"><center><input type="submit" value="Go!"></center></td></tr>
|
<tr><td colspan="2"><input type="submit" value="Go!"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</center>
|
</center>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
update_qs();
|
||||||
|
});
|
||||||
|
function update_qs() {
|
||||||
|
$(".dbconf").hide();
|
||||||
|
var seldb = $("#database_type").val();
|
||||||
|
$("."+seldb).show();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Help</h3>
|
<h3>Help</h3>
|
||||||
|
|
||||||
<p>Please make sure the database you have chosen exists and is empty.<br>
|
<p class="dbconf mysql pgsql">
|
||||||
The username provided must have access to create tables within the database.</p>
|
Please make sure the database you have chosen exists and is empty.<br>
|
||||||
|
The username provided must have access to create tables within the database.
|
||||||
|
</p>
|
||||||
|
<p class="dbconf sqlite">
|
||||||
|
For SQLite the database name will be a filename on disk, relative to
|
||||||
|
where shimmie was installed.
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
|
@ -27,3 +27,35 @@ IMG.lazy {display: none;}
|
|||||||
border: 1px solid #882;
|
border: 1px solid #882;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#installer {
|
||||||
|
background: #EEE;
|
||||||
|
font-family: "Arial", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
width: 512px;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 16px;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
#installer A {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
#installer A:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
#installer H1, H3 {
|
||||||
|
background: #DDD;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
#installer H1 {
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
border-radius: 16px 16px 0px 0px;
|
||||||
|
}
|
||||||
|
#installer H3 {
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user