diff options
Diffstat (limited to 'installer')
-rw-r--r-- | installer/check.php | 15 | ||||
-rw-r--r-- | installer/config.php | 7 | ||||
-rw-r--r-- | installer/index.php | 1 | ||||
-rw-r--r-- | installer/rcube_install.php | 59 | ||||
-rw-r--r-- | installer/test.php | 20 |
5 files changed, 51 insertions, 51 deletions
diff --git a/installer/check.php b/installer/check.php index d6c9f5c40..14fc4f06e 100644 --- a/installer/check.php +++ b/installer/check.php @@ -1,3 +1,10 @@ +<?php + +if (!class_exists('rcube_install') || !is_object($RCI)) { + die("Not allowed! Please open installer/index.php instead."); +} + +?> <form action="index.php" method="get"> <?php @@ -130,7 +137,13 @@ foreach ($optional_php_exts as $name => $ext) { $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; foreach ($RCI->supported_dbs as $database => $ext) { if (extension_loaded($ext)) { - $RCI->pass($database); + // MySQL driver requires PHP >= 5.3 (#1488875) + if ($ext == 'pdo_mysql' && version_compare(PHP_VERSION, '5.3.0', '<')) { + $RCI->fail($database, 'PHP >= 5.3 required'); + } + else { + $RCI->pass($database); + } } else { $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; diff --git a/installer/config.php b/installer/config.php index 6897ffbba..d6846edc7 100644 --- a/installer/config.php +++ b/installer/config.php @@ -1,3 +1,10 @@ +<?php + +if (!class_exists('rcube_install') || !is_object($RCI)) { + die("Not allowed! Please open installer/index.php instead."); +} + +?> <form action="index.php" method="post"> <input type="hidden" name="_step" value="2" /> <?php diff --git a/installer/index.php b/installer/index.php index 7a78736b8..0e80b1cd6 100644 --- a/installer/index.php +++ b/installer/index.php @@ -44,7 +44,6 @@ define('RCUBE_INSTALL_PATH', INSTALL_PATH); define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/'); $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; -$include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR; $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; $include_path .= ini_get('include_path'); diff --git a/installer/rcube_install.php b/installer/rcube_install.php index dfd63562d..08761ce6d 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -29,7 +29,6 @@ class rcube_install var $config = array(); var $configured = false; var $last_error = null; - var $db_map = array('pgsql' => 'postgres', 'mysqli' => 'mysql', 'sqlsrv' => 'mssql'); var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; var $bool_config_props = array(); @@ -65,7 +64,7 @@ class rcube_install /** * Constructor */ - function rcube_install() + function __construct() { $this->step = intval($_REQUEST['_step']); $this->is_post = $_SERVER['REQUEST_METHOD'] == 'POST'; @@ -74,7 +73,7 @@ class rcube_install /** * Singleton getter */ - function get_instance() + static function get_instance() { static $inst; @@ -261,6 +260,11 @@ class rcube_install } } + // the old default mime_magic reference is obsolete + if ($this->config['mime_magic'] == '/usr/share/misc/magic') { + $out['obsolete'][] = array('prop' => 'mime_magic', 'explain' => "Set value to null in order to use system default"); + } + // iterate over default config foreach ($defaults as $prop => $value) { if (!isset($seen[$prop]) && isset($required[$prop]) && !(is_bool($this->config[$prop]) || strlen($this->config[$prop]))) @@ -448,10 +452,11 @@ class rcube_install '0.2-alpha', '0.2-beta', '0.2-stable', '0.3-stable', '0.3.1', '0.4-beta', '0.4.2', - '0.5-beta', '0.5', '0.5.1', + '0.5-beta', '0.5', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.6-beta', '0.6', - '0.7-beta', '0.7', '0.7.1', '0.7.2', '0.7.3', - '0.8-beta', '0.8-rc', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', + '0.7-beta', '0.7', '0.7.1', '0.7.2', '0.7.3', '0.7.4', + '0.8-beta', '0.8-rc', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', + '0.9-beta', '0.9-rc', '0.9-rc2', )); return $select; } @@ -603,7 +608,7 @@ class rcube_install */ function init_db($DB) { - $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; + $engine = $DB->db_provider; // read schema file from /SQL/* $fname = INSTALL_PATH . "SQL/$engine.initial.sql"; @@ -625,46 +630,18 @@ class rcube_install /** - * Update database with SQL statements from SQL/*.update.sql + * Update database schema * - * @param object rcube_db Database connection * @param string Version to update from + * * @return boolen True on success, False on error */ - function update_db($DB, $version) + function update_db($version) { - $version = strtolower($version); - $engine = isset($this->db_map[$DB->db_provider]) ? $this->db_map[$DB->db_provider] : $DB->db_provider; - - // read schema file from /SQL/* - $fname = INSTALL_PATH . "SQL/$engine.update.sql"; - if ($lines = @file($fname, FILE_SKIP_EMPTY_LINES)) { - $from = false; $sql = ''; - foreach ($lines as $line) { - $is_comment = preg_match('/^--/', $line); - if (!$from && $is_comment && preg_match('/from version\s([0-9.]+[a-z-]*)/', $line, $m)) { - $v = strtolower($m[1]); - if ($v == $version || version_compare($version, $v, '<=')) - $from = true; - } - if ($from && !$is_comment) - $sql .= $line. "\n"; - } - - if ($sql) - $this->exec_sql($sql, $DB); - } - else { - $this->fail('DB Schema', "Cannot read the update file: $fname"); - return false; - } + system(INSTALL_PATH . "bin/updatedb.sh --package=roundcube --version=" . $version + . " --dir=" . INSTALL_PATH . "SQL", $result); - if ($err = $this->get_error()) { - $this->fail('DB Schema', "Error updating database: $err"); - return false; - } - - return true; + return !$result; } diff --git a/installer/test.php b/installer/test.php index e266bf05f..bd49ac523 100644 --- a/installer/test.php +++ b/installer/test.php @@ -1,3 +1,10 @@ +<?php + +if (!class_exists('rcube_install') || !is_object($RCI)) { + die("Not allowed! Please open installer/index.php instead."); +} + +?> <form action="index.php?_step=3" method="post"> <h3>Check config files</h3> @@ -157,11 +164,9 @@ if ($db_working && $_POST['initdb']) { } else if ($db_working && $_POST['updatedb']) { - if (!($success = $RCI->update_db($DB, $_POST['version']))) { - $updatefile = INSTALL_PATH . 'SQL/' . (isset($RCI->db_map[$DB->db_provider]) ? $RCI->db_map[$DB->db_provider] : $DB->db_provider) . '.update.sql'; - echo '<p class="warning">Please manually execute the SQL statements from '.$updatefile.' on your database.<br/>'; - echo 'See comments in the file and execute queries below the comment with the currently installed version number.</p>'; - } + if (!($success = $RCI->update_db($_POST['version']))) { + echo '<p class="warning">Database schema update failed.</p>'; + } } // test database @@ -176,9 +181,8 @@ if ($db_working) { $RCI->fail('DB Schema', "Database schema differs"); echo '<ul style="margin:0"><li>' . join("</li>\n<li>", $err) . "</li></ul>"; $select = $RCI->versions_select(array('name' => 'version')); - echo '<p class="suggestion">You should run the update queries to get the schmea fixed.<br/><br/>Version to update from: ' . $select->show() . ' <input type="submit" name="updatedb" value="Update" /></p>'; -// echo '<p class="warning">Please manually execute the SQL statements from '.$updatefile.' on your database.<br/>'; -// echo 'See comments in the file and execute queries that are superscribed with the currently installed version number.</p>'; + $select->add('0.9 or newer', ''); + echo '<p class="suggestion">You should run the update queries to get the schema fixed.<br/><br/>Version to update from: ' . $select->show() . ' <input type="submit" name="updatedb" value="Update" /></p>'; $db_working = false; } else { |