X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=blobdiff_plain;f=includes%2FTitle.php;h=eb1907604e98ec6a6a496cc5f03ae18f1a60c4ec;hb=bb94f4964d1da0ed6a5fc3ae9f0e1b629a8cfd96;hp=95ccd9a4569e7414edbcbaf08030bdd23ee653e9;hpb=1c5deb40ad077c9bebe809930a74bfbc2c871247;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 95ccd9a456..eb1907604e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -23,6 +23,7 @@ */ use MediaWiki\Permissions\PermissionManager; +use MediaWiki\Storage\RevisionRecord; use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\Database; use Wikimedia\Rdbms\IDatabase; @@ -181,7 +182,8 @@ class Title implements LinkTarget, IDBAccessObject { private $mPageLanguage = false; /** @var string|bool|null The page language code from the database, null if not saved in - * the database or false if not loaded, yet. */ + * the database or false if not loaded, yet. + */ private $mDbPageLanguage = false; /** @var TitleValue|null A corresponding TitleValue object */ @@ -2504,8 +2506,9 @@ class Title implements LinkTarget, IDBAccessObject { 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; } } @@ -3181,7 +3184,7 @@ class Title implements LinkTarget, IDBAccessObject { 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; } @@ -3459,7 +3462,7 @@ class Title implements LinkTarget, IDBAccessObject { return [ [ 'badtitletext' ] ]; } - $mp = new MovePage( $this, $nt ); + $mp = MediaWikiServices::getInstance()->getMovePageFactory()->newMovePage( $this, $nt ); $errors = $mp->isValidMove()->getErrorsArray(); if ( $auth ) { $errors = wfMergeErrorArrays( @@ -3491,7 +3494,7 @@ class Title implements LinkTarget, IDBAccessObject { 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() ) { @@ -3947,17 +3950,18 @@ class Title implements LinkTarget, IDBAccessObject { if ( $old->getId() === $new->getId() ) { return ( $old_cmp === '>' && $new_cmp === '<' ) ? [] : - [ $old->getUserText( Revision::RAW ) ]; + [ $old->getUserText( RevisionRecord::RAW ) ]; } elseif ( $old->getId() === $new->getParentId() ) { if ( $old_cmp === '>=' && $new_cmp === '<=' ) { - $authors[] = $old->getUserText( Revision::RAW ); - if ( $old->getUserText( Revision::RAW ) != $new->getUserText( Revision::RAW ) ) { - $authors[] = $new->getUserText( Revision::RAW ); + $authors[] = $oldUserText = $old->getUserText( RevisionRecord::RAW ); + $newUserText = $new->getUserText( RevisionRecord::RAW ); + if ( $oldUserText != $newUserText ) { + $authors[] = $newUserText; } } elseif ( $old_cmp === '>=' ) { - $authors[] = $old->getUserText( Revision::RAW ); + $authors[] = $old->getUserText( RevisionRecord::RAW ); } elseif ( $new_cmp === '<=' ) { - $authors[] = $new->getUserText( Revision::RAW ); + $authors[] = $new->getUserText( RevisionRecord::RAW ); } return $authors; }