Merge "Fix function/class case"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 30 Mar 2019 00:22:25 +0000 (00:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 30 Mar 2019 00:22:25 +0000 (00:22 +0000)
includes/DefaultSettings.php
includes/api/ApiMain.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiUndelete.php
includes/db/MWLBFactory.php
includes/interwiki/Interwiki.php
includes/jobqueue/Job.php
includes/jobqueue/jobs/RefreshLinksJob.php
includes/specials/SpecialUndelete.php

index 3a040c8..f16b8cb 100644 (file)
@@ -749,7 +749,7 @@ $wgUploadDialog = [
  *   - a) Whether it is fully qualified or wiki-relative.
  *        By default, the paths of files are relative to the current wiki,
  *        which works via prefixing them with the current wiki ID when accessed.
- *        Setting 'wikiId' forces the backend to be fully qualified by prefixing
+ *        Setting 'domainId' forces the backend to be fully qualified by prefixing
  *        all paths with the specified value instead. This can be useful if
  *        multiple wikis need to share the same data. Note that 'name' is *not*
  *        part of any prefix and thus should not be relied upon for namespacing.
index 261e4a4..f60443c 100644 (file)
@@ -218,7 +218,7 @@ class ApiMain extends ApiBase {
                                                'cookies' => $sessionCookies,
                                                'ip' => $request->getIP(),
                                                'userAgent' => $this->getUserAgent(),
-                                               'wiki' => wfWikiID(),
+                                               'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                                        ]
                                );
                        }
@@ -1633,7 +1633,7 @@ class ApiMain extends ApiBase {
                        'ts' => time(),
                        'ip' => $request->getIP(),
                        'userAgent' => $this->getUserAgent(),
-                       'wiki' => wfWikiID(),
+                       'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'timeSpentBackend' => (int)round( $time * 1000 ),
                        'hadError' => $e !== null,
                        'errorCodes' => [],
@@ -1653,7 +1653,7 @@ class ApiMain extends ApiBase {
                                'method' => $request->getMethod(),
                                'client_ip' => $request->getIP()
                        ],
-                       'database' => wfWikiID(),
+                       'database' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'backend_time_ms' => (int)round( $time * 1000 ),
                ];
 
index 82a52b4..ea2f31b 100644 (file)
@@ -236,7 +236,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
                $data['server'] = $config->get( 'Server' );
                $data['servername'] = $config->get( 'ServerName' );
-               $data['wikiid'] = wfWikiID();
+               $data['wikiid'] = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
                $data['time'] = wfTimestamp( TS_ISO_8601, time() );
 
                $data['misermode'] = (bool)$config->get( 'MiserMode' );
index 07a6aae..5f9b97c 100644 (file)
@@ -31,7 +31,8 @@ class ApiUndelete extends ApiBase {
                $params = $this->extractRequestParams();
 
                $user = $this->getUser();
-               if ( $user->isBlocked() ) {
+               $block = $user->getBlock();
+               if ( $block && $block->isSitewide() ) {
                        $this->dieBlocked( $user->getBlock() );
                }
 
index fc5b18a..416993c 100644 (file)
@@ -243,8 +243,8 @@ abstract class MWLBFactory {
                        "\$wgDBservers has dbname='$srvDB' but \$wgDBname='$ldDB'. " .
                        "Set \$wgDBname to the database used by this wiki project. " .
                        "There is rarely a need to set 'dbname' in \$wgDBservers. " .
-                       "Functions like wfWikiId(), remote wiki database access, the use " .
-                       "of Database::getDomainId(), and other features are not reliable when " .
+                       "Cross-wiki database access, use of WikiMap::getCurrentWikiDbDomain(), " .
+                       "use of Database::getDomainId(), and other features are not reliable when " .
                        "\$wgDBservers does not match the local wiki database/prefix."
                );
                MWExceptionRenderer::output( $e, MWExceptionRenderer::AS_PRETTY );
@@ -260,8 +260,8 @@ abstract class MWLBFactory {
                        "\$wgDBservers has tablePrefix='$srvTP' but \$wgDBprefix='$ldTP'. " .
                        "Set \$wgDBprefix to the table prefix used by this wiki project. " .
                        "There is rarely a need to set 'tablePrefix' in \$wgDBservers. " .
-                       "Functions like wfWikiId(), remote wiki database access, the use " .
-                       "of Database::getDomainId(), and other features are not reliable when " .
+                       "Cross-wiki database access, use of WikiMap::getCurrentWikiDbDomain(), " .
+                       "use of Database::getDomainId(), and other features are not reliable when " .
                        "\$wgDBservers does not match the local wiki database/prefix."
                );
                MWExceptionRenderer::output( $e, MWExceptionRenderer::AS_PRETTY );
index 832883b..30826d4 100644 (file)
@@ -36,7 +36,7 @@ class Interwiki {
        protected $mAPI;
 
        /** @var string The name of the database (for a connection to be established
-        *    with LBFactory::getMainLB( 'wikiid' ))
+        *    with LBFactory::getMainLB( 'domainId' ))
         */
        protected $mWikiID;
 
index 9306657..24fc473 100644 (file)
@@ -132,7 +132,7 @@ abstract class Job implements IJobSpecification {
         * @since 1.31
         */
        public function hasExecutionFlag( $flag ) {
-               return ( $this->executionFlags && $flag ) === $flag;
+               return ( $this->executionFlags & $flag ) === $flag;
        }
 
        /**
index 7f9b2a3..0cfaebe 100644 (file)
@@ -54,6 +54,8 @@ class RefreshLinksJob extends Job {
                        !( isset( $params['pages'] ) && count( $params['pages'] ) != 1 )
                );
                $this->params += [ 'causeAction' => 'unknown', 'causeAgent' => 'unknown' ];
+               // This will control transaction rounds in order to run DataUpdates
+               $this->executionFlags |= self::JOB_NO_EXPLICIT_TRX_ROUND;
        }
 
        /**
@@ -145,6 +147,8 @@ class RefreshLinksJob extends Job {
                $renderer = $services->getRevisionRenderer();
                $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
 
+               $lbFactory->beginMasterChanges( __METHOD__ );
+
                $page = WikiPage::factory( $title );
                $page->loadPageData( WikiPage::READ_LATEST );
 
@@ -284,6 +288,9 @@ class RefreshLinksJob extends Job {
                                $options['triggeringUser'] = User::newFromName( $userInfo['userName'], false );
                        }
                }
+
+               $lbFactory->commitMasterChanges( __METHOD__ );
+
                $page->doSecondaryDataUpdates( $options );
 
                InfoAction::invalidateCache( $title );
index 3fabfd2..c5c68df 100644 (file)
@@ -95,7 +95,8 @@ class SpecialUndelete extends SpecialPage {
                $this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' );
                $this->mToken = $request->getVal( 'token' );
 
-               if ( $this->isAllowed( 'undelete' ) && !$user->isBlocked() ) {
+               $block = $user->getBlock();
+               if ( $this->isAllowed( 'undelete' ) && !( $block && $block->isSitewide() ) ) {
                        $this->mAllowed = true; // user can restore
                        $this->mCanView = true; // user can view content
                } elseif ( $this->isAllowed( 'deletedtext' ) ) {