Drop the check for existences of LocalSettings.php in MediaWikiIntegrationTestCase
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 486dfe4..05c4655 100644 (file)
@@ -30,8 +30,8 @@ use MediaWiki\MediaWikiServices;
 use MediaWiki\ProcOpenError;
 use MediaWiki\Session\SessionManager;
 use MediaWiki\Shell\Shell;
-use Wikimedia\ScopedCallback;
 use Wikimedia\WrappedString;
+use Wikimedia\AtEase\AtEase;
 
 /**
  * Load an extension
@@ -799,9 +799,9 @@ function wfParseUrl( $url ) {
        if ( $wasRelative ) {
                $url = "http:$url";
        }
-       Wikimedia\suppressWarnings();
+       AtEase::suppressWarnings();
        $bits = parse_url( $url );
-       Wikimedia\restoreWarnings();
+       AtEase::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'] ) ) {
@@ -1846,24 +1846,6 @@ function wfNegotiateType( $cprefs, $sprefs ) {
        return $besttype;
 }
 
-/**
- * Reference-counted warning suppression
- *
- * @deprecated since 1.26, use Wikimedia\suppressWarnings() directly
- * @param bool $end
- */
-function wfSuppressWarnings( $end = false ) {
-       Wikimedia\suppressWarnings( $end );
-}
-
-/**
- * @deprecated since 1.26, use Wikimedia\restoreWarnings() directly
- * Restore error level to previous value
- */
-function wfRestoreWarnings() {
-       Wikimedia\restoreWarnings();
-}
-
 /**
  * Get a timestamp string in one of various formats
  *
@@ -1899,10 +1881,9 @@ function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) {
 /**
  * Convenience function; returns MediaWiki timestamp for the present time.
  *
- * @return string
+ * @return string TS_MW timestamp
  */
 function wfTimestampNow() {
-       # return NOW
        return MWTimestamp::now( TS_MW );
 }
 
@@ -1990,9 +1971,9 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) {
        }
 
        // Turn off the normal warning, we're doing our own below
-       Wikimedia\suppressWarnings();
+       AtEase::suppressWarnings();
        $ok = mkdir( $dir, $mode, true ); // PHP5 <3
-       Wikimedia\restoreWarnings();
+       AtEase::restoreWarnings();
 
        if ( !$ok ) {
                // directory may have been created on another request since we last checked
@@ -2230,9 +2211,9 @@ function wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult = null ) {
 
        # This check may also protect against code injection in
        # case of broken installations.
-       Wikimedia\suppressWarnings();
+       AtEase::suppressWarnings();
        $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
-       Wikimedia\restoreWarnings();
+       AtEase::restoreWarnings();
 
        if ( !$haveDiff3 ) {
                wfDebug( "diff3 not found\n" );
@@ -2314,9 +2295,9 @@ function wfDiff( $before, $after, $params = '-u' ) {
        }
 
        global $wgDiff;
-       Wikimedia\suppressWarnings();
+       AtEase::suppressWarnings();
        $haveDiff = $wgDiff && file_exists( $wgDiff );
-       Wikimedia\restoreWarnings();
+       AtEase::restoreWarnings();
 
        # This check may also protect against code injection in
        # case of broken installations.
@@ -2448,28 +2429,6 @@ function wfRelativePath( $path, $from ) {
        return implode( DIRECTORY_SEPARATOR, $pieces );
 }
 
-/**
- * Reset the session id
- *
- * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead
- * @since 1.22
- */
-function wfResetSessionID() {
-       wfDeprecated( __FUNCTION__, '1.27' );
-       $session = SessionManager::getGlobalSession();
-       $delay = $session->delaySave();
-
-       $session->resetId();
-
-       // Make sure a session is started, since that's what the old
-       // wfResetSessionID() did.
-       if ( session_id() !== $session->getId() ) {
-               wfSetupSession( $session->getId() );
-       }
-
-       ScopedCallback::consume( $delay );
-}
-
 /**
  * Initialise php session
  *
@@ -2492,7 +2451,7 @@ function wfSetupSession( $sessionId = false ) {
        if ( session_id() !== $session->getId() ) {
                session_id( $session->getId() );
        }
-       Wikimedia\quietCall( 'session_start' );
+       AtEase::quietCall( 'session_start' );
 }
 
 /**
@@ -2618,19 +2577,6 @@ function wfGetLB( $wiki = false ) {
        }
 }
 
-/**
- * Get the load balancer factory object
- *
- * @deprecated since 1.27, use MediaWikiServices::getInstance()->getDBLoadBalancerFactory() instead.
- * TODO: Remove in MediaWiki 1.35
- *
- * @return \Wikimedia\Rdbms\LBFactory
- */
-function wfGetLBFactory() {
-       wfDeprecated( __METHOD__, '1.27' );
-       return MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-}
-
 /**
  * Find a file.
  * @deprecated since 1.34, use MediaWikiServices
@@ -2779,30 +2725,6 @@ function wfWaitForSlaves(
        return $lbFactory->waitForReplication( $opts );
 }
 
-/**
- * Count down from $seconds to zero on the terminal, with a one-second pause
- * between showing each number. For use in command-line scripts.
- *
- * @deprecated since 1.31, use Maintenance::countDown()
- *
- * @codeCoverageIgnore
- * @param int $seconds
- */
-function wfCountDown( $seconds ) {
-       wfDeprecated( __FUNCTION__, '1.31' );
-       for ( $i = $seconds; $i >= 0; $i-- ) {
-               if ( $i != $seconds ) {
-                       echo str_repeat( "\x08", strlen( $i + 1 ) );
-               }
-               echo $i;
-               flush();
-               if ( $i ) {
-                       sleep( 1 );
-               }
-       }
-       echo "\n";
-}
-
 /**
  * Replace all invalid characters with '-'.
  * Additional characters can be defined in $wgIllegalFileChars (see T22489).
@@ -2902,21 +2824,6 @@ function wfShorthandToInteger( $string = '', $default = -1 ) {
        return $val;
 }
 
-/**
- * Get the normalised IETF language tag
- * See unit test for examples.
- * See mediawiki.language.bcp47 for the JavaScript implementation.
- *
- * @deprecated since 1.31, use LanguageCode::bcp47() directly.
- *
- * @param string $code The language code.
- * @return string The language code which complying with BCP 47 standards.
- */
-function wfBCP47( $code ) {
-       wfDeprecated( __METHOD__, '1.31' );
-       return LanguageCode::bcp47( $code );
-}
-
 /**
  * Get a specific cache object.
  *
@@ -3001,7 +2908,7 @@ function wfUnpack( $format, $data, $length = false ) {
 function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
        # Handle redirects; callers almost always hit wfFindFile() anyway,
        # so just use that method because it has a fast process cache.
-       $file = wfFindFile( $name ); // get the final name
+       $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $name ); // get the final name
        $name = $file ? $file->getTitle()->getDBkey() : $name;
 
        # Run the extension hook