SpecialStatistics: Use Config instead of globals
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index b40b007..4c2b772 100644 (file)
@@ -176,21 +176,6 @@ function wfArrayDiff2_cmp( $a, $b ) {
        }
 }
 
-/**
- * Array lookup
- * Returns an array where the values in array $b are replaced by the
- * values in array $a with the corresponding keys
- *
- * @deprecated since 1.22; use array_intersect_key()
- * @param array $a
- * @param array $b
- * @return array
- */
-function wfArrayLookup( $a, $b ) {
-       wfDeprecated( __FUNCTION__, '1.22' );
-       return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
-}
-
 /**
  * Appends to second array if $value differs from that in $default
  *
@@ -209,27 +194,6 @@ function wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed ) {
        }
 }
 
-/**
- * Backwards array plus for people who haven't bothered to read the PHP manual
- * XXX: will not darn your socks for you.
- *
- * @deprecated since 1.22; use array_replace()
- *
- * @param array $array1 Initial array to merge.
- * @param array $array2,... Variable list of arrays to merge.
- * @return array
- */
-function wfArrayMerge( $array1 /*...*/ ) {
-       wfDeprecated( __FUNCTION__, '1.22' );
-       $args = func_get_args();
-       $args = array_reverse( $args, true );
-       $out = array();
-       foreach ( $args as $arg ) {
-               $out += $arg;
-       }
-       return $out;
-}
-
 /**
  * Merge arrays in the style of getUserPermissionsErrors, with duplicate removal
  * e.g.
@@ -1807,19 +1771,6 @@ function wfEmptyMsg( $key ) {
        return MessageCache::singleton()->get( $key, /*useDB*/true, /*content*/false ) === false;
 }
 
-/**
- * Throw a debugging exception. This function previously once exited the process,
- * but now throws an exception instead, with similar results.
- *
- * @deprecated since 1.22; just throw an MWException yourself
- * @param string $msg Message shown when dying.
- * @throws MWException
- */
-function wfDebugDieBacktrace( $msg = '' ) {
-       wfDeprecated( __FUNCTION__, '1.22' );
-       throw new MWException( $msg );
-}
-
 /**
  * Fetch server name for use in error reporting etc.
  * Use real server name if available, so we know which machine
@@ -2116,16 +2067,6 @@ function wfEscapeWikiText( $text ) {
        return $text;
 }
 
-/**
- * Get the current unix timestamp with microseconds.  Useful for profiling
- * @deprecated since 1.22; call microtime() directly
- * @return float
- */
-function wfTime() {
-       wfDeprecated( __FUNCTION__, '1.22' );
-       return microtime( true );
-}
-
 /**
  * Sets dest to source and returns the original value of dest
  * If source is NULL, it just returns the value, it doesn't set the variable
@@ -3811,6 +3752,7 @@ function wfGetNull() {
  * @param float|null $ifWritesSince Only wait if writes were done since this UNIX timestamp
  * @param string|bool $wiki Wiki identifier accepted by wfGetLB
  * @param string|bool $cluster Cluster name accepted by LBFactory. Default: false.
+ * @return bool Success (able to connect and no timeouts reached)
  */
 function wfWaitForSlaves( $ifWritesSince = false, $wiki = false, $cluster = false ) {
        // B/C: first argument used to be "max seconds of lag"; ignore such values
@@ -3826,19 +3768,21 @@ function wfWaitForSlaves( $ifWritesSince = false, $wiki = false, $cluster = fals
        // Prevents permission error when getting master position
        if ( $lb->getServerCount() > 1 ) {
                if ( $ifWritesSince && !$lb->hasMasterConnection() ) {
-                       return; // assume no writes done
+                       return true; // assume no writes done
                }
                $dbw = $lb->getConnection( DB_MASTER, array(), $wiki );
                if ( $ifWritesSince && $dbw->lastDoneWrites() < $ifWritesSince ) {
-                       return; // no writes since the last wait
+                       return true; // no writes since the last wait
                }
                $pos = $dbw->getMasterPos();
                // The DBMS may not support getMasterPos() or the whole
                // load balancer might be fake (e.g. $wgAllDBsAreLocalhost).
                if ( $pos !== false ) {
-                       $lb->waitForAll( $pos );
+                       return $lb->waitForAll( $pos, PHP_SAPI === 'cli' ? 86400 : null );
                }
        }
+
+       return true;
 }
 
 /**