Merge "Change "Special:近易" to "Special:監修" in zh-classical"
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index aea441b..82753a1 100644 (file)
@@ -125,7 +125,6 @@ class ApiMain extends ApiBase {
                'none' => 'ApiFormatNone',
        ];
 
-       // @codingStandardsIgnoreStart String contenation on "msg" not allowed to break long line
        /**
         * List of user roles that are specifically relevant to the API.
         * [ 'right' => [ 'msg'    => 'Some message with a $1',
@@ -142,7 +141,6 @@ class ApiMain extends ApiBase {
                        'params' => [ ApiBase::LIMIT_SML2, ApiBase::LIMIT_BIG2 ]
                ]
        ];
-       // @codingStandardsIgnoreEnd
 
        /**
         * @var ApiFormatBase
@@ -1454,7 +1452,7 @@ class ApiMain extends ApiBase {
 
                if ( $module->isWriteMode()
                        && $this->getUser()->isBot()
-                       && wfGetLB()->getServerCount() > 1
+                       && MediaWikiServices::getInstance()->getDBLoadBalancer()->getServerCount() > 1
                ) {
                        $this->checkBotReadOnly();
                }
@@ -1468,7 +1466,7 @@ class ApiMain extends ApiBase {
                $numLagged = 0;
                $lagLimit = $this->getConfig()->get( 'APIMaxLagThreshold' );
                $laggedServers = [];
-               $loadBalancer = wfGetLB();
+               $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
                foreach ( $loadBalancer->getLagTimes() as $serverIndex => $lag ) {
                        if ( $lag > $lagLimit ) {
                                ++$numLagged;
@@ -1477,7 +1475,7 @@ class ApiMain extends ApiBase {
                }
 
                // If a majority of replica DBs are too lagged then disallow writes
-               $replicaCount = wfGetLB()->getServerCount() - 1;
+               $replicaCount = $loadBalancer->getServerCount() - 1;
                if ( $numLagged >= ceil( $replicaCount / 2 ) ) {
                        $laggedServers = implode( ', ', $laggedServers );
                        wfDebugLog(
@@ -1935,7 +1933,7 @@ class ApiMain extends ApiBase {
                        $id = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_PRIMARY );
                        $idFallback = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_FALLBACK );
                        $headline = Linker::makeHeadline( min( 6, $level ),
-                               ' class="apihelp-header"',
+                               ' class="apihelp-header">',
                                $id,
                                $header,
                                '',
@@ -1963,7 +1961,7 @@ class ApiMain extends ApiBase {
                        $id = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_PRIMARY );
                        $idFallback = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_FALLBACK );
                        $headline = Linker::makeHeadline( min( 6, $level ),
-                               ' class="apihelp-header"',
+                               ' class="apihelp-header">',
                                $id,
                                $header,
                                '',