Merge "HTMLForm: Remove deprecated unused getErrors() method"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index c7a45c7..7256eab 100644 (file)
@@ -32,6 +32,7 @@ use MediaWiki\Session\SessionManager;
 use MediaWiki\Shell\Shell;
 use Wikimedia\ScopedCallback;
 use Wikimedia\WrappedString;
+use Wikimedia\AtEase\AtEase;
 
 /**
  * Load an extension
@@ -799,9 +800,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 +1847,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
  *
@@ -1990,9 +1973,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 +2213,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 +2297,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.
@@ -2492,7 +2475,7 @@ function wfSetupSession( $sessionId = false ) {
        if ( session_id() !== $session->getId() ) {
                session_id( $session->getId() );
        }
-       Wikimedia\quietCall( 'session_start' );
+       AtEase::quietCall( 'session_start' );
 }
 
 /**
@@ -2627,31 +2610,31 @@ function wfGetLB( $wiki = false ) {
  * @return \Wikimedia\Rdbms\LBFactory
  */
 function wfGetLBFactory() {
-       wfDeprecated( __METHOD__, '1.34' );
+       wfDeprecated( __METHOD__, '1.27' );
        return MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
 }
 
 /**
  * Find a file.
- * Shortcut for RepoGroup::singleton()->findFile()
- *
+ * @deprecated since 1.34, use MediaWikiServices
  * @param string|LinkTarget $title String or LinkTarget object
  * @param array $options Associative array of options (see RepoGroup::findFile)
  * @return File|bool File, or false if the file does not exist
  */
 function wfFindFile( $title, $options = [] ) {
-       return RepoGroup::singleton()->findFile( $title, $options );
+       return MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title, $options );
 }
 
 /**
  * Get an object referring to a locally registered file.
  * Returns a valid placeholder object if the file does not exist.
  *
+ * @deprecated since 1.34, use MediaWikiServices
  * @param Title|string $title
  * @return LocalFile|null A File, or null if passed an invalid Title
  */
 function wfLocalFile( $title ) {
-       return RepoGroup::singleton()->getLocalRepo()->newFile( $title );
+       return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile( $title );
 }
 
 /**