r100030 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100029‎ | r100030 | r100031 >
Date:14:24, 17 October 2011
Author:cervidae
Status:deferred
Tags:
Comment:
Fixing access bug and adding new permission and translation message, approved by Adam
Modified paths:
  • /trunk/extensions/MassEditRegex/MassEditRegex.class.php (modified) (history)
  • /trunk/extensions/MassEditRegex/MassEditRegex.i18n.php (modified) (history)
  • /trunk/extensions/MassEditRegex/MassEditRegex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MassEditRegex/MassEditRegex.i18n.php
@@ -50,6 +50,8 @@
5151 'masseditregex-badregex' => 'Invalid regex:',
5252 'masseditregex-editfailed' => 'Edit failed:',
5353 'masseditregex-tooltip-execute' => 'Apply these changes to each page',
 54+
 55+ 'right-masseditregex' => 'Replace page contents using regular expressions',
5456 );
5557
5658 /** Message documentation (Message documentation)
@@ -61,6 +63,8 @@
6264 'masseditregex-desc' => '{{desc}}',
6365 'masseditregextext' => 'Replace <code>/en/</code> in the middle in link <code>http://php.net/manual/en/function.preg-replace.php</code> with your language code between slashes, if that page exists. Otherwise leave it as is to link to the English documentation, or choose an appropriate fallback language code.',
6466 'masseditregex-hint-headmatch' => "Noun. This is a column header for the 'match' regexes.",
 67+
 68+ 'right-masseditregex' => '{{doc-right|masseditregex}}',
6569 );
6670
6771 /** Afrikaans (Afrikaans)
@@ -433,6 +437,8 @@
434438 'masseditregex-badregex' => 'Ungültiger regulärer Ausdruck:',
435439 'masseditregex-editfailed' => 'Bearbeitung fehlgeschlagen:',
436440 'masseditregex-tooltip-execute' => 'Diese Änderungen an jeder Seite durchführen',
 441+
 442+ 'right-masseditregex' => 'Textersetzungen mit regulären Ausdrücken durchführen',
437443 );
438444
439445 /** German (formal address) (‪Deutsch (Sie-Form)‬)
Index: trunk/extensions/MassEditRegex/MassEditRegex.php
@@ -30,3 +30,6 @@
3131 $wgAutoloadClasses['MassEditRegex'] = $dir . 'MassEditRegex.class.php';
3232 $wgSpecialPages['MassEditRegex'] = 'MassEditRegex';
3333 $wgSpecialPageGroups['MassEditRegex'] = 'pagetools';
 34+
 35+// Required permission to use Special:MassEditRegex
 36+$wgAvailableRights[] = 'masseditregex';
Index: trunk/extensions/MassEditRegex/MassEditRegex.class.php
@@ -34,7 +34,7 @@
3535 private $sk;
3636
3737 function __construct() {
38 - parent::__construct( 'MassEditRegex', 'bot' );
 38+ parent::__construct( 'MassEditRegex', 'masseditregex' );
3939 }
4040
4141 function execute( $par ) {
@@ -42,11 +42,26 @@
4343
4444 $this->setHeaders();
4545
46 - #if ( !$wgUser->isAllowed( 'bot' ) ) {
47 - # $wgOut->permissionRequired( 'bot' );
48 - # return;
49 - #}
 46+ # Check permissions
 47+ if ( !$wgUser->isAllowed( 'masseditregex' ) ) {
 48+ $this->displayRestrictionError();
 49+ return;
 50+ }
5051
 52+ # Show a message if the database is in read-only mode
 53+ if ( wfReadOnly() ) {
 54+ $wgOut->readOnlyPage();
 55+ return;
 56+ }
 57+
 58+ # If user is blocked, s/he doesn't need to access this page
 59+ if ( $wgUser->isBlocked() ) {
 60+ $wgOut->blockedPage();
 61+ return;
 62+ }
 63+
 64+ wfLoadExtensionMessages('MassEditRegex');
 65+
5166 $this->outputHeader();
5267
5368 $strPageList = $wgRequest->getText( 'wpPageList', 'Sandbox' );

Status & tagging log