global $wgNamespaceProtection;
if ( isset( $wgNamespaceProtection[$this->mNamespace] ) ) {
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
foreach ( (array)$wgNamespaceProtection[$this->mNamespace] as $right ) {
- if ( $right != '' && !$user->isAllowed( $right ) ) {
+ if ( !$permissionManager->userHasRight( $user, $right ) ) {
return true;
}
}
public static function capitalize( $text, $ns = NS_MAIN ) {
$services = MediaWikiServices::getInstance();
if ( $services->getNamespaceInfo()->isCapitalized( $ns ) ) {
- return MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $text );
+ return $services->getContentLanguage()->ucfirst( $text );
} else {
return $text;
}
/**
* Purge all applicable CDN URLs
- * @deprecated 1.34 Use HtmlCacheUpdater
*/
public function purgeSquid() {
- MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $this->getCdnUrls() );
+ DeferredUpdates::addUpdate(
+ new CdnCacheUpdate( $this->getCdnUrls() ),
+ DeferredUpdates::PRESEND
+ );
}
/**
return [ [ 'badtitletext' ] ];
}
- $mp = new MovePage( $this, $nt );
+ $mp = MediaWikiServices::getInstance()->getMovePageFactory()->newMovePage( $this, $nt );
$errors = $mp->isValidMove()->getErrorsArray();
if ( $auth ) {
$errors = wfMergeErrorArrays(
global $wgUser;
- $mp = new MovePage( $this, $nt );
+ $mp = MediaWikiServices::getInstance()->getMovePageFactory()->newMovePage( $this, $nt );
$method = $auth ? 'moveIfAllowed' : 'move';
$status = $mp->$method( $wgUser, $reason, $createRedirect, $changeTags );
if ( $status->isOK() ) {
* on the number of links. Typically called on create and delete.
*/
public function touchLinks() {
- $jobs = [];
- $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
- $this,
- 'pagelinks',
- [ 'causeAction' => 'page-touch' ]
- );
+ DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks', 'page-touch' ) );
if ( $this->mNamespace == NS_CATEGORY ) {
- $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
- $this,
- 'categorylinks',
- [ 'causeAction' => 'category-touch' ]
+ DeferredUpdates::addUpdate(
+ new HTMLCacheUpdate( $this, 'categorylinks', 'category-touch' )
);
}
-
- JobQueueGroup::singleton()->lazyPush( $jobs );
}
/**