Changeset 1064

Show
Ignore:
Timestamp:
05/05/2008 10:27:41 AM (2 years ago)
Author:
DotMG
Message:

refs #740

Porting trunk's intelligent version check to 1.1.6.5

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.1.6.5/wikka.php

    r1052 r1064  
    5151 */ 
    5252if (!defined('ERROR_WAKKA_LIBRARY_MISSING')) define('ERROR_WAKKA_LIBRARY_MISSING','The necessary file "libs/Wakka.class.php" could not be found. To run Wikka, please make sure the file exists and is placed in the right directory!'); 
    53 if (!defined('ERROR_WRONG_PHP_VERSION')) define('ERROR_WRONG_PHP_VERSION', '$_REQUEST[] not found. Wakka requires PHP 4.1.0 or higher!'); 
     53define('ERROR_WRONG_PHP_VERSION', 'Wikka requires PHP %s or higher!');  // %s - version number 
     54define('MINIMUM_PHP_VERSION', '4.1'); 
    5455if (!defined('ERROR_MYSQL_SUPPORT_MISSING')) define('ERROR_MYSQL_SUPPORT_MISSING', 'PHP can\'t find MySQL support but Wikka requires MySQL. Please check the output of <tt>phpinfo()</tt> in a php document for MySQL support: it needs to be compiled into PHP, the module itself needs to be present in the expected location, <strong>and</strong> php.ini needs to have it enabled.<br />Also note that you cannot have <tt>mysqli</tt> and <tt>mysql</tt> support both enabled at the same time.<br />Please double-check all of these things, restart your webserver after any fixes, and then try again!'); 
    5556if (!defined('ERROR_SETUP_FILE_MISSING')) define('ERROR_SETUP_FILE_MISSING', 'A file of the installer/ upgrader was not found. Please install Wikka again!'); 
     
    8283// Sanity checks - we die if these conditions aren't met 
    8384 
    84 // stupid version check 
    85 if (!isset($_REQUEST)) 
    86 { 
    87         die(ERROR_WRONG_PHP_VERSION); // TODO replace with php version_compare 
     85// More intelligent version check, more intelligently placed ;) 
     86if (!function_exists('version_compare') || 
     87        version_compare(phpversion(),MINIMUM_PHP_VERSION,'<')   // < PHP minimum version?? 
     88   ) 
     89{ 
     90        $php_version_error = sprintf(ERROR_WRONG_PHP_VERSION,MINIMUM_PHP_VERSION); 
     91        die($php_version_error);                # fatalerror    !!! default error in English 
    8892} 
    8993// MySQL needs to be installed and available