X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=3ce775b8bc80d95e94a786c4d3f41689e4878f15;hb=21f2b1e099c12e44083c3a6de0abd6561964ea6d;hp=4d496e457a58ff43f245b9d3e81211d955c70a66;hpb=ad26f9e92ab598cfb2b8446656d031b8778b1048;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 4d496e457a..3ce775b8bc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1233,12 +1233,6 @@ class Title implements LinkTarget { && ( $this->hasContentModel( CONTENT_MODEL_CSS ) || $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT ) ); - # @note This hook is also called in ContentHandler::getDefaultModel. - # It's called here again to make sure hook functions can force this - # method to return true even outside the MediaWiki namespace. - - Hooks::run( 'TitleIsCssOrJsPage', [ $this, &$isCssOrJsPage ], '1.25' ); - return $isCssOrJsPage; } @@ -2423,7 +2417,7 @@ class Title implements LinkTarget { * * @param string $action The action to check * @param bool $short Short circuit on first error - * @return array List of errors + * @return array Array containing an error message key and any parameters */ private function missingPermissionError( $action, $short ) { // We avoid expensive display logic for quickUserCan's and such @@ -2431,19 +2425,7 @@ class Title implements LinkTarget { return [ 'badaccess-group0' ]; } - $groups = array_map( [ 'User', 'makeGroupLinkWiki' ], - User::getGroupsWithPermission( $action ) ); - - if ( count( $groups ) ) { - global $wgLang; - return [ - 'badaccess-groups', - $wgLang->commaList( $groups ), - count( $groups ) - ]; - } else { - return [ 'badaccess-group0' ]; - } + return User::newFatalPermissionDeniedStatus( $action )->getErrorsArray()[0]; } /** @@ -3672,9 +3654,12 @@ class Title implements LinkTarget { * @param string $reason The reason for the move * @param bool $createRedirect Whether to create a redirect from the old title to the new title. * Ignored if the user doesn't have the suppressredirect right. + * @param array $changeTags Applied to the entry in the move log and redirect page revision * @return array|bool True on success, getUserPermissionsErrors()-like array on failure */ - public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { + public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true, + array $changeTags = [] ) { + global $wgUser; $err = $this->isValidMoveOperation( $nt, $auth, $reason ); if ( is_array( $err ) ) { @@ -3688,7 +3673,7 @@ class Title implements LinkTarget { } $mp = new MovePage( $this, $nt ); - $status = $mp->move( $wgUser, $reason, $createRedirect ); + $status = $mp->move( $wgUser, $reason, $createRedirect, $changeTags ); if ( $status->isOK() ) { return true; } else { @@ -3704,12 +3689,15 @@ class Title implements LinkTarget { * @param string $reason The reason for the move * @param bool $createRedirect Whether to create redirects from the old subpages to * the new ones Ignored if the user doesn't have the 'suppressredirect' right + * @param array $changeTags Applied to the entry in the move log and redirect page revision * @return array Array with old page titles as keys, and strings (new page titles) or * getUserPermissionsErrors()-like arrays (errors) as values, or a * getUserPermissionsErrors()-like error array with numeric indices if * no pages were moved */ - public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true ) { + public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true, + array $changeTags = [] ) { + global $wgMaximumMovedPages; // Check permissions if ( !$this->userCan( 'move-subpages' ) ) { @@ -3764,7 +3752,7 @@ class Title implements LinkTarget { # be longer than 255 characters. $newSubpage = Title::makeTitleSafe( $newNs, $newPageName ); - $success = $oldSubpage->moveTo( $newSubpage, $auth, $reason, $createRedirect ); + $success = $oldSubpage->moveTo( $newSubpage, $auth, $reason, $createRedirect, $changeTags ); if ( $success === true ) { $retval[$oldSubpage->getPrefixedText()] = $newSubpage->getPrefixedText(); } else {