diff options
Diffstat (limited to 'installer')
-rw-r--r-- | installer/check.php | 46 | ||||
-rw-r--r-- | installer/rcube_install.php | 52 | ||||
-rw-r--r-- | installer/test.php | 36 |
3 files changed, 115 insertions, 19 deletions
diff --git a/installer/check.php b/installer/check.php index fcf35025e..ee0c9f367 100644 --- a/installer/check.php +++ b/installer/check.php @@ -42,12 +42,13 @@ $ini_checks = array( 'suhosin.session.encrypt' => 0, 'magic_quotes_runtime' => 0, 'magic_quotes_sybase' => 0, - 'date.timezone' => '-NOTEMPTY-', ); $optional_checks = array( // required for utils/modcss.inc, should we require this? 'allow_url_fopen' => 1, + 'date.timezone' => '-VALID-', + 'register_globals' => 0, // #1489157 ); $source_urls = array( @@ -139,10 +140,11 @@ foreach ($RCI->supported_dbs as $database => $ext) { if (extension_loaded($ext)) { // 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'); + $RCI->fail($database, 'PHP >= 5.3 required', null, true); } else { $RCI->pass($database); + $found_db_driver = true; } } else { @@ -152,6 +154,9 @@ foreach ($RCI->supported_dbs as $database => $ext) { } echo '<br />'; } +if (empty($found_db_driver)) { + $RCI->failures++; +} ?> @@ -185,23 +190,15 @@ foreach ($ini_checks as $var => $val) { if ($val === '-NOTEMPTY-') { if (empty($status)) { $RCI->fail($var, "empty value detected"); - } else if ($var == 'date.timezone') { - try { - $tz = new DateTimeZone($status); - $RCI->pass($var); - } - catch (Exception $e) { - $RCI->fail($var, "invalid value detected: $status"); - } - } else { + } + else { $RCI->pass($var); } - echo '<br />'; - continue; } - if ($status == $val) { + else if (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) { $RCI->pass($var); - } else { + } + else { $RCI->fail($var, "is '$status', should be '$val'"); } echo '<br />'; @@ -223,9 +220,24 @@ foreach ($optional_checks as $var => $val) { echo '<br />'; continue; } - if ($status == $val) { + if ($val === '-VALID-') { + if ($var == 'date.timezone') { + try { + $tz = new DateTimeZone($status); + $RCI->pass($var); + } + catch (Exception $e) { + $RCI->optfail($var, empty($status) ? "not set" : "invalid value detected: $status"); + } + } + else { + $RCI->pass($var); + } + } + else if (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) { $RCI->pass($var); - } else { + } + else { $RCI->optfail($var, "is '$status', could be '$val'"); } echo '<br />'; diff --git a/installer/rcube_install.php b/installer/rcube_install.php index da636555b..600db34ab 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -432,6 +432,51 @@ class rcube_install return $schema; } + /** + * Try to detect some file's mimetypes to test the correct behavior of fileinfo + */ + function check_mime_detection() + { + $files = array( + 'installer/images/roundcube_logo.png' => 'image/png', + 'program/resources/blank.tif' => 'image/tiff', + 'skins/larry/templates/login.html' => 'text/html', + ); + + $errors = array(); + foreach ($files as $path => $expected) { + $mimetype = rcube_mime::file_content_type(INSTALL_PATH . $path, basename($path)); + if ($mimetype != $expected) { + $errors[] = array($path, $mimetype, $expected); + } + } + + return $errors; + } + + /** + * Check the correct configuration of the 'mime_types' mapping option + */ + function check_mime_extensions() + { + $types = array( + 'application/zip' => 'zip', + 'application/x-tar' => 'tar', + 'application/java-archive' => 'jar', + 'image/bmp' => 'bmp', + 'image/svg+xml' => 'svg', + ); + + $errors = array(); + foreach ($types as $mimetype => $expected) { + $ext = rcube_mime::get_mime_extensions($mimetype); + if ($ext[0] != $expected) { + $errors[] = array($mimetype, $ext, $expected); + } + } + + return $errors; + } /** * Getter for the last error message @@ -517,10 +562,13 @@ class rcube_install * @param string Test name * @param string Error message * @param string URL for details + * @param bool Do not count this failure */ - function fail($name, $message = '', $url = '') + function fail($name, $message = '', $url = '', $optional=false) { - $this->failures++; + if (!$optional) { + $this->failures++; + } echo Q($name) . ': <span class="fail">NOT OK</span>'; $this->_showhint($message, $url); diff --git a/installer/test.php b/installer/test.php index c2e321455..f834308ad 100644 --- a/installer/test.php +++ b/installer/test.php @@ -207,6 +207,42 @@ if ($db_working) { ?> +<h3>Test filetype detection</h3> + +<p> +<?php + +if ($errors = $RCI->check_mime_detection()) { + $RCI->fail('Fileinfo/mime_content_type configuration'); + if (!empty($RCI->config['mime_magic'])) { + echo '<p class="hint">Try setting the <tt>mime_magic</tt> config option to <tt>null</tt>.</p>'; + } + else { + echo '<p class="hint">Check the <a href="http://www.php.net/manual/en/function.finfo-open.php">Fileinfo functions</a> of your PHP installation.<br/>'; + echo 'The path to the magic.mime file can be set using the <tt>mime_magic</tt> config option in Roundcube.</p>'; + } +} +else { + $RCI->pass('Fileinfo/mime_content_type configuration'); +} + +?> +</p> +<p> +<?php + +if ($errors = $RCI->check_mime_extensions()) { + $RCI->fail('Mimetype to file extension mapping'); + echo '<p class="hint">Please set a valid path to your webserver\'s mime.types file to the <tt>mime_types</tt> config option.<br/>'; + echo 'If you can\'t find such a file, download it from <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">svn.apache.org</a>.</p>'; +} +else { + $RCI->pass('Mimetype to file extension mapping'); +} + +?> + + <h3>Test SMTP config</h3> <p> |