diff --git a/LinkTitles.php b/LinkTitles.php index 73ae8b1..31af399 100755 --- a/LinkTitles.php +++ b/LinkTitles.php @@ -59,8 +59,12 @@ $wgAutoloadClasses['LinkTitles'] = dirname( __FILE__ ) . '/LinkTitles.body.php'; $wgAutoloadClasses['SpecialLinkTitles'] = dirname( __FILE__ ) . '/SpecialLinkTitles.php'; $wgExtensionFunctions[] = 'LinkTitles::setup'; + + // Settings for the batch-processing special page $wgSpecialPages['LinkTitles'] = 'SpecialLinkTitles'; $wgSpecialPageGroups['LinkTitles'] = 'other'; + $wgGroupPermissions['sysop']['linktitles-batch'] = true; + $wgAvailableRights[] = 'linktitles-batch'; // vim: ts=2:sw=2:noet diff --git a/SpecialLinkTitles.php b/SpecialLinkTitles.php index 6b73169..963c4a9 100644 --- a/SpecialLinkTitles.php +++ b/SpecialLinkTitles.php @@ -2,10 +2,19 @@ class SpecialLinkTitles extends SpecialPage { function __construct() { - parent::__construct('LinkTitles'); + // the second parameter in the following function call ensures that only + // users who have the 'linktitles-batch' right get to see this page (by + // default, this are all sysop users). + parent::__construct('LinkTitles', 'linktitles-batch'); } function execute($par) { + // Prevent non-authorized users from executing the batch processing. + if ( !$this->userCanExecute( $this->getUser() ) ) { + $this->displayRestrictionError(); + return; + } + $request = $this->getRequest(); $output = $this->getOutput(); $this->setHeaders();