Merge "Don't add a link to Special:ReplaceText if the user has no permission"

This commit is contained in:
jenkins-bot 2023-01-27 21:34:02 +00:00 committed by Gerrit Code Review
commit 9b0f7ff6fe
2 changed files with 4 additions and 1 deletions

2
README
View file

@ -38,7 +38,7 @@ your MediaWiki 'extensions' directory, then add the following line to your
wfLoadExtension( 'ReplaceText' );
In order to perform replacements, you must have the 'replacetext' permssion;
In order to perform replacements, you must have the 'replacetext' permission;
if you are an administrator on your wiki, the easiest way to do this is to
also add the following line:

View file

@ -89,6 +89,9 @@ class Hooks implements
* @param Title $nt Title object of the new article (moved to)
*/
public function onSpecialMovepageAfterMove( $form, $ot, $nt ) {
if ( !$form->getUser()->isAllowed( 'replacetext' ) ) {
return;
}
$out = $form->getOutput();
$page = $this->specialPageFactory->getPage( 'ReplaceText' );
$pageLink = $form->getLinkRenderer()->makeLink( $page->getPageTitle() );