Merge "Switch Block::purgeExpired to use AutoCommitUpdate"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index a06d721..1d61996 100644 (file)
@@ -877,9 +877,9 @@ function wfParseUrl( $url ) {
        if ( $wasRelative ) {
                $url = "http:$url";
        }
-       MediaWiki\suppressWarnings();
+       Wikimedia\suppressWarnings();
        $bits = parse_url( $url );
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
        // parse_url() returns an array without scheme for some invalid URLs, e.g.
        // parse_url("%0Ahttp://example.com") == [ 'host' => '%0Ahttp', 'path' => 'example.com' ]
        if ( !$bits || !isset( $bits['scheme'] ) ) {
@@ -2009,19 +2009,19 @@ function wfNegotiateType( $cprefs, $sprefs ) {
 /**
  * Reference-counted warning suppression
  *
- * @deprecated since 1.26, use MediaWiki\suppressWarnings() directly
+ * @deprecated since 1.26, use Wikimedia\suppressWarnings() directly
  * @param bool $end
  */
 function wfSuppressWarnings( $end = false ) {
-       MediaWiki\suppressWarnings( $end );
+       Wikimedia\suppressWarnings( $end );
 }
 
 /**
- * @deprecated since 1.26, use MediaWiki\restoreWarnings() directly
+ * @deprecated since 1.26, use Wikimedia\restoreWarnings() directly
  * Restore error level to previous value
  */
 function wfRestoreWarnings() {
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
 }
 
 /**
@@ -2150,9 +2150,9 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) {
        }
 
        // Turn off the normal warning, we're doing our own below
-       MediaWiki\suppressWarnings();
+       Wikimedia\suppressWarnings();
        $ok = mkdir( $dir, $mode, true ); // PHP5 <3
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
 
        if ( !$ok ) {
                // directory may have been created on another request since we last checked
@@ -2412,9 +2412,9 @@ function wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult = null ) {
 
        # This check may also protect against code injection in
        # case of broken installations.
-       MediaWiki\suppressWarnings();
+       Wikimedia\suppressWarnings();
        $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
 
        if ( !$haveDiff3 ) {
                wfDebug( "diff3 not found\n" );
@@ -2496,9 +2496,9 @@ function wfDiff( $before, $after, $params = '-u' ) {
        }
 
        global $wgDiff;
-       MediaWiki\suppressWarnings();
+       Wikimedia\suppressWarnings();
        $haveDiff = $wgDiff && file_exists( $wgDiff );
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
 
        # This check may also protect against code injection in
        # case of broken installations.
@@ -2686,30 +2686,6 @@ function wfRelativePath( $path, $from ) {
        return implode( DIRECTORY_SEPARATOR, $pieces );
 }
 
-/**
- * Convert an arbitrarily-long digit string from one numeric base
- * to another, optionally zero-padding to a minimum column width.
- *
- * Supports base 2 through 36; digit values 10-36 are represented
- * as lowercase letters a-z. Input is case-insensitive.
- *
- * @deprecated since 1.27 Use Wikimedia\base_convert() directly
- *
- * @param string $input Input number
- * @param int $sourceBase Base of the input number
- * @param int $destBase Desired base of the output
- * @param int $pad Minimum number of digits in the output (pad with zeroes)
- * @param bool $lowercase Whether to output in lowercase or uppercase
- * @param string $engine Either "gmp", "bcmath", or "php"
- * @return string|bool The output number as a string, or false on error
- */
-function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1,
-       $lowercase = true, $engine = 'auto'
-) {
-       wfDeprecated( __FUNCTION__, '1.27' );
-       return Wikimedia\base_convert( $input, $sourceBase, $destBase, $pad, $lowercase, $engine );
-}
-
 /**
  * Reset the session id
  *
@@ -2754,7 +2730,7 @@ function wfSetupSession( $sessionId = false ) {
        if ( session_id() !== $session->getId() ) {
                session_id( $session->getId() );
        }
-       MediaWiki\quietCall( 'session_start' );
+       Wikimedia\quietCall( 'session_start' );
 }
 
 /**
@@ -3052,7 +3028,8 @@ function wfWaitForSlaves(
        }
 
        try {
-               wfGetLBFactory()->waitForReplication( [
+               $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+               $lbFactory->waitForReplication( [
                        'wiki' => $wiki,
                        'cluster' => $cluster,
                        'timeout' => $timeout,
@@ -3122,15 +3099,15 @@ function wfMemoryLimit() {
                $conflimit = wfShorthandToInteger( $wgMemoryLimit );
                if ( $conflimit == -1 ) {
                        wfDebug( "Removing PHP's memory limit\n" );
-                       MediaWiki\suppressWarnings();
+                       Wikimedia\suppressWarnings();
                        ini_set( 'memory_limit', $conflimit );
-                       MediaWiki\restoreWarnings();
+                       Wikimedia\restoreWarnings();
                        return $conflimit;
                } elseif ( $conflimit > $memlimit ) {
                        wfDebug( "Raising PHP's memory limit to $conflimit bytes\n" );
-                       MediaWiki\suppressWarnings();
+                       Wikimedia\suppressWarnings();
                        ini_set( 'memory_limit', $conflimit );
-                       MediaWiki\restoreWarnings();
+                       Wikimedia\restoreWarnings();
                        return $conflimit;
                }
        }
@@ -3283,9 +3260,9 @@ function wfUnpack( $format, $data, $length = false ) {
                }
        }
 
-       MediaWiki\suppressWarnings();
+       Wikimedia\suppressWarnings();
        $result = unpack( $format, $data );
-       MediaWiki\restoreWarnings();
+       Wikimedia\restoreWarnings();
 
        if ( $result === false ) {
                // If it cannot extract the packed data.
@@ -3527,19 +3504,3 @@ function wfGetRusage() {
                return getrusage( 0 /* RUSAGE_SELF */ );
        }
 }
-
-/**
- * Begin profiling of a function
- * @param string $functionname Name of the function we will profile
- * @deprecated since 1.25
- */
-function wfProfileIn( $functionname ) {
-}
-
-/**
- * Stop profiling of a function
- * @param string $functionname Name of the function we have profiled
- * @deprecated since 1.25
- */
-function wfProfileOut( $functionname = 'missing' ) {
-}