Merge "Don't fallback from uk to ru"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderModule.php
index 2351efd..8124f33 100644 (file)
  * @author Roan Kattouw
  */
 
+use MediaWiki\MediaWikiServices;
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
 use Psr\Log\NullLogger;
+use Wikimedia\ScopedCallback;
 
 /**
  * Abstraction for ResourceLoader modules, with name registration and maxage functionality.
@@ -186,7 +188,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        public function getConfig() {
                if ( $this->config === null ) {
                        // Ugh, fall back to default
-                       $this->config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+                       $this->config = MediaWikiServices::getInstance()->getMainConfig();
                }
 
                return $this->config;
@@ -329,14 +331,13 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        }
 
        /**
-        * Where on the HTML page should this module's JS be loaded?
-        *  - 'top': in the "<head>"
-        *  - 'bottom': at the bottom of the "<body>"
+        * From where in the page HTML should this module be loaded?
         *
+        * @deprecated since 1.29 Obsolete. All modules load async from `<head>`.
         * @return string
         */
        public function getPosition() {
-               return 'bottom';
+               return 'top';
        }
 
        /**
@@ -487,9 +488,12 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                );
 
                                if ( $dbw->trxLevel() ) {
-                                       $dbw->onTransactionResolution( function () use ( &$scopeLock ) {
-                                               ScopedCallback::consume( $scopeLock ); // release after commit
-                                       } );
+                                       $dbw->onTransactionResolution(
+                                               function () use ( &$scopeLock ) {
+                                                       ScopedCallback::consume( $scopeLock ); // release after commit
+                                               },
+                                               __METHOD__
+                                       );
                                }
                        }
                } catch ( Exception $e ) {