Page MenuHomePhabricator

GlobalFunctions.patch

Authored By
bzimport
Nov 21 2014, 9:20 PM
Size
2 KB
Referenced Files
None
Subscribers
None

GlobalFunctions.patch

Index: GlobalFunctions.php
===================================================================
--- GlobalFunctions.php (revision 15769)
+++ GlobalFunctions.php (working copy)
@@ -33,9 +33,6 @@
/**
* 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.
@@ -49,22 +46,6 @@
}
}
-if( !function_exists('file_get_contents') ) {
- # Exists in PHP 4.3.0+
- function file_get_contents( $filename ) {
- return implode( '', file( $filename ) );
- }
-}
-
-if( !function_exists('is_a') ) {
- # Exists in PHP 4.2.0+
- function is_a( $object, $class_name ) {
- return
- (strcasecmp( get_class( $object ), $class_name ) == 0) ||
- is_subclass_of( $object, $class_name );
- }
-}
-
# UTF-8 substr function based on a PHP manual comment
if ( !function_exists( 'mb_substr' ) ) {
function mb_substr( $str, $start ) {
@@ -79,17 +60,6 @@
}
}
-if( !function_exists( 'floatval' ) ) {
- /**
- * First defined in PHP 4.2.0
- * @param mixed $var;
- * @return float
- */
- function floatval( $var ) {
- return (float)$var;
- }
-}
-
if ( !function_exists( 'array_diff_key' ) ) {
/**
* Exists in PHP 5.1.0+
@@ -107,44 +77,7 @@
}
}
-
/**
- * Wrapper for clone() for PHP 4, for the moment.
- * PHP 5 won't let you declare a 'clone' function, even conditionally,
- * so it has to be a wrapper with a different name.
- */
-function wfClone( $object ) {
- // WARNING: clone() is not a function in PHP 5, so function_exists fails.
- if( version_compare( PHP_VERSION, '5.0' ) < 0 ) {
- return $object;
- } else {
- return clone( $object );
- }
-}
-
-/**
- * Where as we got a random seed
- * @var bool $wgTotalViews
- */
-$wgRandomSeeded = false;
-
-/**
- * Seed Mersenne Twister
- * Only necessary in PHP < 4.2.0
- *
- * @return bool
- */
-function wfSeedRandom() {
- global $wgRandomSeeded;
-
- if ( ! $wgRandomSeeded && version_compare( phpversion(), '4.2.0' ) < 0 ) {
- $seed = hexdec(substr(md5(microtime()),-8)) & 0x7fffffff;
- mt_srand( $seed );
- $wgRandomSeeded = true;
- }
-}
-
-/**
* Get a random decimal value between 0 and 1, in a way
* not likely to give duplicate values for any realistic
* number of articles.

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604
Default Alt Text
GlobalFunctions.patch (2 KB)

Event Timeline