include_once( "$IP/UpdateClasses.php" );
include_once( "$IP/LogPage.php" );
-# PHP 4.1+ has array_key_exists, PHP 4.0.6 has key_exists instead, and earlier
-# versions of PHP have neither. So we roll our own. Note that this
-# function will return false even for keys that exist but whose associated
-# value is NULL.
-#
-if ( phpversion() == "4.0.6" ) {
- function array_key_exists( $k, $a ) {
- return key_exists( $k, $a );
- }
-} else if (phpversion() < "4.1") {
- function array_key_exists( $k, $a ) {
- return isset($a[$k]);
- }
-}
+/*
+ * Compatibility functions
+ */
+
+# PHP <4.3.x is not actively supported; 4.1.x and 4.2.x might or might not work.
+# <4.1.x will not work, as we use a number of features introduced in 4.1.0
+# such as the new autoglobals.
if( !function_exists('iconv') ) {
+ # iconv support is not in the default configuration and so may not be present.
# Assume will only ever use utf-8 and iso-8859-1.
# This will *not* work in all circumstances.
function iconv( $from, $to, $string ) {
<?
+if( !function_exists( "version_compare" ) ) {
+ # version_compare was introduced in 4.1.0
+ die( "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is recommended. ABORTING.\n" );
+}
+if( version_compare( phpversion(), "4.3.2" ) < 0 ) {
+ echo "WARNING: PHP 4.3.2 or higher is recommended. Older versions from 4.1.x up may work but are not actively supported.\n\n";
+}
+if( !ini_get( "register_globals" ) ) {
+ echo "WARNING: register_globals is not on; MediaWiki currently relies on this option.\n\n";
+}
+
if (!extension_loaded('mysql')) {
if (!dl('mysql.so')) {
print "Could not load MySQL driver! Please compile ".
<?
+if( !function_exists( "version_compare" ) ) {
+ # version_compare was introduced in 4.1.0
+ die( "Your PHP version is much too old; 4.0.x will _not_ work. 4.3.2 or higher is recommended. ABORTING.\n" );
+}
+if( version_compare( phpversion(), "4.3.2" ) < 0 ) {
+ echo "WARNING: PHP 4.3.2 or higher is recommended. Older versions from 4.1.x up may work but are not actively supported.\n\n";
+}
+if( !ini_get( "register_globals" ) ) {
+ echo "WARNING: register_globals is not on; MediaWiki currently relies on this option.\n\n";
+}
/*
function readconsole() {
$fp = fopen( "php://stdin", "r" );
- $resp = trim( fgets( $fp ) );
+ $resp = trim( fgets( $fp, 1024 ) );
fclose( $fp );
return $resp;
}