prepared installer

This commit is contained in:
Steffen Vogel 2010-09-22 02:25:12 +02:00
parent 752445118f
commit 11ec19d486
5 changed files with 129 additions and 14 deletions

90
share/tools/check.php Normal file
View file

@ -0,0 +1,90 @@
<?php
/**
* Check for required libraries and versions
*
* @author Steffen Vogel <info@steffenvogel.de>
* @copyright Copyright (c) 2010, The volkszaehler.org project
* @license http://www.gnu.org/licenses/gpl.txt GNU Public License
*/
/*
* This file is part of volkzaehler.org
*
* volkzaehler.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* volkzaehler.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @param boolean
* @return string HTML formatted output
*/
function print_test($bool) {
if ($bool) {
return '<span style="text-align: right; color: green; font-weight: bold;">ok</span>';
}
else {
return '<span style="text-align: right; color: red; font-weight: bold;">fail</span>';
}
}
array(
'php_version' => version_compare(phpversion(), '5.3.0'),
'pdo' => extension_loaded('pdo'),
'pdo_version' => version_compare(phpversion('pdo'), '5.3.0')),
'pdo_my'
extension_loaded('pdo_firebird')
extension_loaded('pdo_informix')
extension_loaded('pdo_mssql')
extension_loaded('pdo_mysql')
extension_loaded('pdo_oci')
extension_loaded('pdo_oci8')
extension_loaded('pdo_odbc')
extension_loaded('pdo_pgsql')
extension_loaded('pdo_sqlite')
pdo_firebird
pdo_informix
pdo_mssql
pdo_mysql
pdo_oci
pdo_oci8
pdo_odbc
pdo_pgsql
pdo_sqlite
)
?>
<h2>PHP version</h2>
<p>Your PHP version: <?= phpversion() ?><br />
Required version: 5.3.0<br />
<?= print_test()?></p>
<h2>PDO (PHP Data Objects)</h2>
<p>Your PDO version: <?= phpversion('pdo') ?><br />
Required version: 5.3.0<br />
<?= print_test(FALSE && version_compare(phpversion('pdo'), '5.3.0'))?></p>
// TODO check for PDO drivers (at least one)
// TODO check for additional Doctrine requirements
// TODO check for APC (optional)
// TODO check for Doctrine libraries & version
// TODO check for Symfony libraries &version (optional)
// TODO check for volkszaehler.org backend
// TODO check for volkszaehler.org (optional)
?>

View file

@ -10,7 +10,6 @@
* @author Steffen Vogel <info@steffenvogel.de>
* @package tools
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
* @todo propably we could put this into install.php later..
*/
/*
* This file is part of volkzaehler.org

View file

@ -5,6 +5,8 @@
* @copyright Copyright (c) 2010, The volkszaehler.org project
* @package tools
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
* @todo adapt to doctrine dbal or use native pdo
* @todo move to installer
*/
/*
* This file is part of volkzaehler.org

View file

@ -5,7 +5,8 @@
* @copyright Copyright (c) 2010, The volkszaehler.org project
* @package tools
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
* @todo adapt to doctrine dal or use native mysql
* @todo adapt to doctrine dbal or use native pdo
* @todo move to installer
*/
/*
* This file is part of volkzaehler.org

View file

@ -1,12 +1,15 @@
<?php
/**
* install script
* Installer
*
* for creating/updating of the configuration/database
* For creating/updating the configuration/database
* and downloading of required libraries
* and configuration of of the PHP interpreter/webserver
*
* @copyright Copyright (c) 2010, The volkszaehler.org project
* @package tools
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
* @todo finish
*/
/*
* This file is part of volkzaehler.org
@ -31,22 +34,42 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>volkszaehler.org - installer</title>
<title>volkszaehler.org - installation</title>
</head>
<body>
<h1>volkszaehler.org - installation</h1>
<?php
// TODO complete installer
// TODO start session with GET-parameter (no cookies)
switch (@$_GET['step']) {
case '1':
echo 'bla';
break;
default:
echo '<p>welcome to the installation of your volkszaehler backend!</p>
<p>lets proceed with the <a href="?step=1">next step</a></p>';
if (isset($_GET['step'])) {
if (file_exists($_GET['step'] . '.php')) {
include $_GET['step'] . '.php';
}
else {
// TODO check js history call
echo '<span style="color: red; font-weight: bold;">Invalid step during installation: ' . $_GET['step'] . '</span>
<p><a href="javascript:window.location.back()">back</a></p>';
}
}
else {
echo <<<EOT
<p>Welcome to the installation of your volkszaehler.org!<br />
This installer will:
<ul>
<li>check for all requirements</li>
<li>install missing libraries</li>
<li>setup your database + configuration</li>
<li>import your existing data</li>
<li>test your installation</li>
</ul>
Only fundamental administration knowledge is required :)
</p>
<p>
So, ready? Take a cup of coffee and lets take a look on your system:</p>
<p><a href="?step=check">Start with step 1: analyze your system</a></p>
EOT;
}
?>