* - 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.
'cookies' => $sessionCookies,
'ip' => $request->getIP(),
'userAgent' => $this->getUserAgent(),
- 'wiki' => wfWikiID(),
+ 'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
]
);
}
'ts' => time(),
'ip' => $request->getIP(),
'userAgent' => $this->getUserAgent(),
- 'wiki' => wfWikiID(),
+ 'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
'timeSpentBackend' => (int)round( $time * 1000 ),
'hadError' => $e !== null,
'errorCodes' => [],
'method' => $request->getMethod(),
'client_ip' => $request->getIP()
],
- 'database' => wfWikiID(),
+ 'database' => WikiMap::getCurrentWikiDbDomain()->getId(),
'backend_time_ms' => (int)round( $time * 1000 ),
];
$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' );
$params = $this->extractRequestParams();
$user = $this->getUser();
- if ( $user->isBlocked() ) {
+ $block = $user->getBlock();
+ if ( $block && $block->isSitewide() ) {
$this->dieBlocked( $user->getBlock() );
}
"\$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 );
"\$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 );
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;
* @since 1.31
*/
public function hasExecutionFlag( $flag ) {
- return ( $this->executionFlags && $flag ) === $flag;
+ return ( $this->executionFlags & $flag ) === $flag;
}
/**
!( 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;
}
/**
$renderer = $services->getRevisionRenderer();
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+ $lbFactory->beginMasterChanges( __METHOD__ );
+
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
$options['triggeringUser'] = User::newFromName( $userInfo['userName'], false );
}
}
+
+ $lbFactory->commitMasterChanges( __METHOD__ );
+
$page->doSecondaryDataUpdates( $options );
InfoAction::invalidateCache( $title );
$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' ) ) {