From 86681eebf7ee2bf28b12fd12ee6a5fe70bc36d0a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 17 Sep 2009 07:29:37 -0700 Subject: Move the check_environment into the installer helper and call it from the command line installer as well as the web installer. --- installer/installer.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'installer/installer.php') diff --git a/installer/installer.php b/installer/installer.php index 7a417634..70afc440 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -178,4 +178,45 @@ class installer { static function prepend_prefix($prefix, $sql) { return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql); } + + static function check_environment() { + if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { + $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the MySQL or the MySQLi extension."; + } + + if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { + $errors[] = "PHP is missing Perl-Compatible Regular Expression support."; + } + + if (!(function_exists("spl_autoload_register"))) { + $errors[] = "PHP is missing Standard PHP Library (SPL) support"; + } + + if (!(class_exists("ReflectionClass"))) { + $errors[] = "PHP is missing reflection support"; + } + + if (!(function_exists("filter_list"))) { + $errors[] = "PHP is missing the filter extension"; + } + + if (!(extension_loaded("iconv"))) { + $errors[] = "PHP is missing the iconv extension"; + } + + if (!(extension_loaded("simplexml"))) { + $errors[] = "PHP is missing the SimpleXML extension"; + } + + if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { + $errors[] = "The mbstring extension is overloading PHP's native string functions. Please disable it."; + } + + if (!function_exists("json_encode")) { + $errors[] = "PHP is missing the JavaScript Object Notation (JSON) extension. Please install it."; + } + + return @$errors; +} + } -- cgit v1.2.3