| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package Dotclear |
|---|
| 4 | * @subpackage Install |
|---|
| 5 | * |
|---|
| 6 | * @copyright Olivier Meunier & Association Dotclear |
|---|
| 7 | * @copyright GPL-2.0-only |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | if (!defined('DC_RC_PATH')) {return;} |
|---|
| 11 | |
|---|
| 12 | function dcSystemCheck($con, &$err) |
|---|
| 13 | { |
|---|
| 14 | $err = []; |
|---|
| 15 | |
|---|
| 16 | if (version_compare(phpversion(), '5.6', '<')) { |
|---|
| 17 | $err[] = sprintf(__('PHP version is %s (5.6 or earlier needed).'), phpversion()); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | if (!function_exists('mb_detect_encoding')) { |
|---|
| 21 | $err[] = __('Multibyte string module (mbstring) is not available.'); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | if (!function_exists('iconv')) { |
|---|
| 25 | $err[] = __('Iconv module is not available.'); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | if (!function_exists('ob_start')) { |
|---|
| 29 | $err[] = __('Output control functions are not available.'); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | if (!function_exists('simplexml_load_string')) { |
|---|
| 33 | $err[] = __('SimpleXML module is not available.'); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | if (!function_exists('dom_import_simplexml')) { |
|---|
| 37 | $err[] = __('DOM XML module is not available.'); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | $pcre_str = base64_decode('w6nDqMOgw6o='); |
|---|
| 41 | if (!@preg_match('/' . $pcre_str . '/u', $pcre_str)) { |
|---|
| 42 | $err[] = __('PCRE engine does not support UTF-8 strings.'); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | if (!function_exists("spl_classes")) { |
|---|
| 46 | $err[] = __('SPL module is not available.'); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | if ($con->syntax() == 'mysql') { |
|---|
| 50 | if (version_compare($con->version(), '4.1', '<')) { |
|---|
| 51 | $err[] = sprintf(__('MySQL version is %s (4.1 or earlier needed).'), $con->version()); |
|---|
| 52 | } else { |
|---|
| 53 | $rs = $con->select('SHOW ENGINES'); |
|---|
| 54 | $innodb = false; |
|---|
| 55 | while ($rs->fetch()) { |
|---|
| 56 | if (strtolower($rs->f(0)) == 'innodb' && strtolower($rs->f(1)) != 'disabled' && strtolower($rs->f(1)) != 'no') { |
|---|
| 57 | $innodb = true; |
|---|
| 58 | break; |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | if (!$innodb) { |
|---|
| 63 | $err[] = __('MySQL InnoDB engine is not available.'); |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | } elseif ($con->driver() == 'pgsql') { |
|---|
| 67 | if (version_compare($con->version(), '8.0', '<')) { |
|---|
| 68 | $err[] = sprintf(__('PostgreSQL version is %s (8.0 or earlier needed).'), $con->version()); |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | return count($err) == 0; |
|---|
| 73 | } |
|---|