Changeset 190e97e in github
- Timestamp:
- Feb 26, 2008 4:10:07 AM (5 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- ad43e63
- Parents:
- 2a36163
- Files:
-
- 5 edited
-
INSTALL (modified) (2 diffs)
-
installer/config.php (modified) (1 diff)
-
installer/rcube_install.php (modified) (3 diffs)
-
installer/styles.css (modified) (1 diff)
-
installer/test.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
INSTALL
r83ce4bb r190e97e 36 36 - /logs 37 37 3. Create a new database and a database user for RoundCube (see DATABASE SETUP) 38 4. Create database tables using the queries in file 'SQL/*.initial.sql' 39 (* stands for your database type) 40 5. Rename the files config/*.inc.php.dist to config/*.inc.php 41 6. Modify the files in config/* to suit your local environment 38 4. Point your browser to http:///url-to-roundcube/installer/ 39 5. Follow the instructions of the install script (or see MANUAL CONFINGURATION) 40 6. After creating and testing the configuration, remove the installer directory 42 41 7. Done! 43 42 … … 110 109 111 110 112 CONFIGURATION113 ============= 111 MANUAL CONFIGURATION 112 ==================== 114 113 115 114 First of all, rename the files config/*.inc.php.dist to config/*.inc.php. 116 115 You can then change these files according to your environment and your needs. 117 116 Details about the config parameters can be found in the config files. 117 See http://trac.roundcube.net/wiki/Howto_Install for even more guidance. 118 118 119 119 You can also modify the default .htaccess file. This is necessary to -
installer/config.php
rc5042d4 r190e97e 6 6 require_once 'include/rcube_html.inc'; 7 7 8 $RCI-> get_defaults();8 $RCI->load_defaults(); 9 9 10 10 if (!empty($_POST['submit'])) { -
installer/rcube_install.php
rc5042d4 r190e97e 53 53 * Read the default config files and store properties 54 54 */ 55 function get_defaults()55 function load_defaults() 56 56 { 57 57 $this->_load_config('.php.dist'); … … 75 75 include '../config/main.inc' . $suffix; 76 76 if (is_array($rcmail_config)) { 77 $this->config = $rcmail_config;77 $this->config += $rcmail_config; 78 78 } 79 79 … … 237 237 238 238 return $out; 239 } 240 241 242 /** 243 * Initialize the database with the according schema 244 * 245 * @param object rcube_db Database connection 246 * @return boolen True on success, False on error 247 */ 248 function init_db($DB) 249 { 250 $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql'); 251 $engine = isset($db_map[$DB->db_provider]) ? $db_map[$DB->db_provider] : $DB->db_provider; 252 253 // find out db version 254 if ($engine == 'mysql') { 255 $DB->query('SELECT VERSION() AS version'); 256 $sql_arr = $DB->fetch_assoc(); 257 $version = floatval($sql_arr['version']); 258 259 if ($version >= 4.1) 260 $engine = 'mysql5'; 261 } 262 263 // read schema file from /SQL/* 264 $fname = "../SQL/$engine.initial.sql"; 265 if ($lines = @file($fname, FILE_SKIP_EMPTY_LINES)) { 266 $buff = ''; 267 foreach ($lines as $i => $line) { 268 if (eregi('^--', $line)) 269 continue; 270 271 $buff .= $line . "\n"; 272 if (eregi(';$', trim($line))) { 273 $DB->query($buff); 274 $buff = ''; 275 } 276 } 277 } 278 else { 279 $this->fail('DB Schema', "Cannot read the schema file: $fname"); 280 return false; 281 } 282 283 if ($err = $this->get_error()) { 284 $this->fail('DB Schema', "Error creating database schema: $err"); 285 return false; 286 } 287 288 return true; 239 289 } 240 290 -
installer/styles.css
rc5042d4 r190e97e 124 124 font-size: 9pt; 125 125 width: 100%; 126 height: 40em;126 height: 30em; 127 127 } 128 128 -
installer/test.php
rc5042d4 r190e97e 50 50 if (!($db_error_msg = $DB->is_error())) { 51 51 $RCI->pass('DSN (write)'); 52 echo '<br />'; 52 53 $db_working = true; 53 54 } 54 55 else { 55 $RCI->fail('DSN (write)', "Error: $db_error_msg"); 56 $RCI->fail('DSN (write)', $db_error_msg); 57 echo '<p class="hint">Make sure that the configured database extists and that the user as write privileges<br />'; 58 echo 'DSN: ' . $RCI->config['db_dsnw'] . '</p>'; 56 59 } 57 echo '<br />';58 60 } 59 61 else { … … 67 69 // initialize db with schema found in /SQL/* 68 70 if ($db_working && $_POST['initdb']) { 69 $engine = preg_match('/^([a-z]+):/i', $RCI->config['db_dsnw'], $regs) ? $regs[1] : 'mysql'; 70 $fname = '../SQL/' . ($engine == 'pgsql' ? 'postgres' : $engine) . '.initial.sql'; 71 if ($sql = @file_get_contents($fname)) { 72 $DB->query($sql); 73 } 74 else { 75 $RCI->fail('DB Schema', "Cannot read the schema file: $fname"); 76 } 77 78 if ($err = $RCI->get_error()) { 79 $RCI->fail('DB Schema', "Error creating database schema: $err"); 71 if (!($success = $RCI->init_db($DB))) { 80 72 $db_working = false; 81 echo '<p class="warning">Please try to inizialize the database manually as described in the INSTALL guide. </p>';82 echo '<br />';73 echo '<p class="warning">Please try to inizialize the database manually as described in the INSTALL guide. 74 Make sure that the configured database extists and that the user as write privileges</p>'; 83 75 } 84 76 } 85 77 78 // test database 86 79 if ($db_working) { 87 $ success= $DB->query("SELECT count(*) FROM {$RCI->config['db_table_users']}");88 if (!$ success) {80 $db_read = $DB->query("SELECT count(*) FROM {$RCI->config['db_table_users']}"); 81 if (!$db_read) { 89 82 $RCI->fail('DB Schema', "Database not initialized"); 83 $db_working = false; 90 84 echo '<p><input type="submit" name="initdb" value="Initialize database" /></p>'; 91 85 } … … 94 88 } 95 89 echo '<br />'; 90 } 91 92 // more database tests 93 if ($db_working) { 94 // write test 95 $db_write = $DB->query("INSERT INTO {$RCI->config['db_table_cache']} (session_id, cache_key, data, user_id) VALUES (?, ?, ?, 0)", '1234567890abcdef', 'test', 'test'); 96 $insert_id = $DB->insert_id($RCI->config['db_sequence_cache']); 96 97 98 if ($db_write && $insert_id) { 99 $RCI->pass('DB Write'); 100 $DB->query("DELETE FROM {$RCI->config['db_table_cache']} WHERE cache_id=?", $insert_id); 101 } 102 else { 103 $RCI->fail('DB Write', $RCI->get_error()); 104 } 105 echo '<br />'; 106 107 // check timezone settings 97 108 $tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db'; 98 109 $tz_db = $DB->query($tz_db); … … 105 116 if (abs($tz_diff) > 1800) { 106 117 $RCI->fail('DB Time', "Database time differs {$td_ziff}s from PHP time"); 107 } else { 118 } 119 else { 108 120 $RCI->pass('DB Time'); 109 121 } 110 111 122 } 112 113 123 114 124 ?>
Note: See TracChangeset
for help on using the changeset viewer.
