|
1 <?php |
|
2 |
|
3 /* |
|
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
|
5 * Version 1.1.1 |
|
6 * Copyright (C) 2006-2007 Dan Fuhry |
|
7 * Installation package |
|
8 * install.php - Installer payload stage |
|
9 * |
|
10 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
|
11 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
|
12 * |
|
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
|
15 */ |
|
16 |
|
17 if ( !defined('IN_ENANO_INSTALL') ) |
|
18 die(); |
|
19 |
|
20 require ( ENANO_ROOT . '/install/includes/libenanoinstall.php' ); |
|
21 require ( ENANO_ROOT . '/install/includes/sql_parse.php' ); |
|
22 require ( ENANO_ROOT . '/includes/dbal.php' ); |
|
23 require ( ENANO_ROOT . '/config.new.php' ); |
|
24 |
|
25 if ( !in_array($dbdriver, $supported_drivers) ) |
|
26 { |
|
27 $ui->show_header(); |
|
28 echo '<h3>Installation error</h3> |
|
29 <p>ERROR: That database driver is not supported.</p>'; |
|
30 return true; |
|
31 } |
|
32 |
|
33 $db = new $dbdriver(); |
|
34 $result = $db->connect(true, $dbhost, $dbuser, $dbpasswd, $dbname); |
|
35 if ( !$result ) |
|
36 { |
|
37 $ui->show_header(); |
|
38 // FIXME: l10n |
|
39 ?> |
|
40 <form action="install.php?stage=database" method="post" name="database_info"> |
|
41 <input type="hidden" name="language" value="<?php echo $lang_id; ?>" /> |
|
42 <input type="hidden" name="driver" value="<?php echo $dbdriver; ?>" /> |
|
43 <h3>Database connection failed</h3> |
|
44 <p>The installer couldn't connect to the database because something went wrong while the connection attempt was being made. Please press your browser's back button and correct your database information.</p> |
|
45 <p>Error description: |
|
46 <?php |
|
47 echo $db->sql_error(); |
|
48 ?> |
|
49 </p> |
|
50 <p> |
|
51 <input type="submit" name="_cont" value="Go back" /> |
|
52 </p> |
|
53 </form> |
|
54 <?php |
|
55 return true; |
|
56 } |
|
57 |
|
58 // we're connected to the database now. |
|
59 |
|
60 $ui->show_header(); |
|
61 flush(); |
|
62 |
|
63 ?> |
|
64 <h3>Installing Enano</h3> |
|
65 <p>Please wait while Enano creates its database and initial content on your server.</p> |
|
66 |
|
67 <h3>Installation progress</h3> |
|
68 |
|
69 <?php |
|
70 |
|
71 @set_time_limit(0); |
|
72 |
|
73 function stg_load_files() |
|
74 { |
|
75 global $dbdriver; |
|
76 if ( !@include( ENANO_ROOT . "/install/includes/payloads/common.php" ) ) |
|
77 return false; |
|
78 |
|
79 if ( !@include( ENANO_ROOT . "/install/includes/payloads/$dbdriver.php" ) ) |
|
80 return false; |
|
81 |
|
82 return true; |
|
83 } |
|
84 |
|
85 // FIXME: l10n |
|
86 start_install_table(); |
|
87 |
|
88 run_installer_stage('load', 'Load installer files', 'stg_load_files', 'One of the files needed for installation couldn\'t be loaded. Please check your Enano directory.', false); |
|
89 run_installer_stage('setpass', 'Retrieve administrator password', 'stg_password_decode', 'The administrator password couldn\'t be decrypted. This really shouldn\'t happen.'); |
|
90 run_installer_stage('genaes', 'Generate private key', 'stg_make_private_key', 'Couldn\'t generate a private key for the site. This really shouldn\'t happen.'); |
|
91 run_installer_stage('sqlparse', 'Prepare database schema', 'stg_load_schema', 'Couldn\'t load or parse the schema file. This really shouldn\'t happen.'); |
|
92 run_installer_stage('payload', 'Install database', 'stg_deliver_payload', 'There was a problem with an SQL query.'); |
|
93 |
|
94 close_install_table(); |
|
95 |
|
96 $db->close(); |
|
97 |