[MediaWiki-commits] [Gerrit] Update for MW 1.21 - change (mediawiki...MassEditRegex)

2013-07-14 Thread Malvineous (Code Review)
Malvineous has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73609


Change subject: Update for MW 1.21
..

Update for MW 1.21

Rewrite the MW interface to call functions directly instead of going through
the external API.  Also add an 'edit all' tab to category pages and
Special:WhatLinksHere for quick access.

Change-Id: I2ea197d797253b33809a353fd21a633c0347654b
Signed-off-by: Adam Nielsen malvine...@shikadi.net
---
M MassEditRegex.class.php
M MassEditRegex.php
M README
3 files changed, 278 insertions(+), 215 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassEditRegex 
refs/changes/09/73609/1

diff --git a/MassEditRegex.class.php b/MassEditRegex.class.php
index 9712d5e..c00add8 100644
--- a/MassEditRegex.class.php
+++ b/MassEditRegex.class.php
@@ -11,50 +11,53 @@
  * @link http://www.mediawiki.org/wiki/Extension:MassEditRegex Documentation
  *
  * @author Adam Nielsen malvine...@shikadi.net
- * @copyright Copyright © 2009 Adam Nielsen
+ * @copyright Copyright © 2009,2013 Adam Nielsen
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
 
-// Maximum number of pages/diffs to display when previewing the changes
-define('MER_MAX_PREVIEW_DIFFS', 10);
+/// Maximum number of pages/diffs to display when previewing the changes
+define('MER_MAX_PREVIEW_DIFFS', 20);
 
-// Maximum number of pages to edit *for each name in page list*.  No more than
-// 500 (5000 for bots) is allowed according to MW API docs.
+/// Maximum number of pages to edit.
 define('MER_MAX_EXECUTE_PAGES', 1000);
 
 /** Main class that define a new special page*/
 class MassEditRegex extends SpecialPage {
-   private $aPageList;
-   private $strPageListType;
-   private $iNamespace;
-   private $aMatch;
-   private $aReplace;
-   private $strReplace; // keep to avoid having to re-escape again
-   private $strSummary;
-   private $sk;
+   private $aPageList;   /// Array of string - user-supplied page 
titles
+   private $strPageListType; /// Type of titles (categories, backlinks, 
etc.)
+   private $strMatch;/// Match regex from form
+   private $strReplace;  /// Substitution regex from form
+   private $aMatch;  /// $strMatch exploded into array
+   private $aReplace;/// $strReplace exploded into array
+   private $strSummary;  /// Edit summary
+   private $sk;  /// Skin instance
+   private $diff;/// Access to diff engine
 
function __construct() {
parent::__construct( 'MassEditRegex', 'masseditregex' );
}
 
+   /// Run the regexes.
function execute( $par ) {
-   global $wgUser, $wgRequest, $wgOut;
+   global $wgUser;
+
+   $wgOut = $this-getOutput();
 
$this-setHeaders();
 
-   # Check permissions
+   // Check permissions
if ( !$wgUser-isAllowed( 'masseditregex' ) ) {
$this-displayRestrictionError();
return;
}
 
-   # Show a message if the database is in read-only mode
+   // Show a message if the database is in read-only mode
if ( wfReadOnly() ) {
$wgOut-readOnlyPage();
return;
}
 
-   # If user is blocked, s/he doesn't need to access this page
+   // If user is blocked, s/he doesn't need to access this page
if ( $wgUser-isBlocked() ) {
$wgOut-blockedPage();
return;
@@ -62,16 +65,17 @@
 
$this-outputHeader();
 
+   $wgRequest = $this-getRequest();
$strPageList = $wgRequest-getText( 'wpPageList', 'Sandbox' );
$this-aPageList = explode(\n, trim($strPageList));
$this-strPageListType = $wgRequest-getText( 'wpPageListType', 
'pagenames' );
 
$this-iNamespace = $wgRequest-getInt( 'namespace', NS_MAIN );
 
-   $strMatch = $wgRequest-getText( 'wpMatch', '/hello (.*)\n/' );
-   $this-aMatch = explode(\n, trim($strMatch));
+   $this-strMatch = $wgRequest-getText( 'wpMatch', '/hello 
(.*)\n/' );
+   $this-aMatch = explode(\n, trim($this-strMatch));
 
-   $this-strReplace = $wgRequest-getText( 'wpReplace', 'goodbye 
\1' );
+   $this-strReplace = $wgRequest-getText( 'wpReplace', 'goodbye 
$1' );
$this-aReplace = explode(\n, $this-strReplace);
 
$this-strSummary = $wgRequest-getText( 'wpSummary', '' );
@@ -93,11 +97,7 @@
}
 
if ( $wgRequest-wasPosted() ) {
-   if ($wgRequest-getCheck( 'wpPreview' ) ) {
-   

[MediaWiki-commits] [Gerrit] Update for MW 1.21 - change (mediawiki...MassEditRegex)

2013-07-14 Thread Malvineous (Code Review)
Malvineous has submitted this change and it was merged.

Change subject: Update for MW 1.21
..


Update for MW 1.21

Rewrite the MW interface to call functions directly instead of going through
the external API.  Also add an 'edit all' tab to category pages and
Special:WhatLinksHere for quick access.

Change-Id: I2ea197d797253b33809a353fd21a633c0347654b
Signed-off-by: Adam Nielsen malvine...@shikadi.net
---
M MassEditRegex.class.php
M MassEditRegex.php
M README
3 files changed, 278 insertions(+), 215 deletions(-)

Approvals:
  Malvineous: Verified; Looks good to me, approved



diff --git a/MassEditRegex.class.php b/MassEditRegex.class.php
index 9712d5e..c00add8 100644
--- a/MassEditRegex.class.php
+++ b/MassEditRegex.class.php
@@ -11,50 +11,53 @@
  * @link http://www.mediawiki.org/wiki/Extension:MassEditRegex Documentation
  *
  * @author Adam Nielsen malvine...@shikadi.net
- * @copyright Copyright © 2009 Adam Nielsen
+ * @copyright Copyright © 2009,2013 Adam Nielsen
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
 
-// Maximum number of pages/diffs to display when previewing the changes
-define('MER_MAX_PREVIEW_DIFFS', 10);
+/// Maximum number of pages/diffs to display when previewing the changes
+define('MER_MAX_PREVIEW_DIFFS', 20);
 
-// Maximum number of pages to edit *for each name in page list*.  No more than
-// 500 (5000 for bots) is allowed according to MW API docs.
+/// Maximum number of pages to edit.
 define('MER_MAX_EXECUTE_PAGES', 1000);
 
 /** Main class that define a new special page*/
 class MassEditRegex extends SpecialPage {
-   private $aPageList;
-   private $strPageListType;
-   private $iNamespace;
-   private $aMatch;
-   private $aReplace;
-   private $strReplace; // keep to avoid having to re-escape again
-   private $strSummary;
-   private $sk;
+   private $aPageList;   /// Array of string - user-supplied page 
titles
+   private $strPageListType; /// Type of titles (categories, backlinks, 
etc.)
+   private $strMatch;/// Match regex from form
+   private $strReplace;  /// Substitution regex from form
+   private $aMatch;  /// $strMatch exploded into array
+   private $aReplace;/// $strReplace exploded into array
+   private $strSummary;  /// Edit summary
+   private $sk;  /// Skin instance
+   private $diff;/// Access to diff engine
 
function __construct() {
parent::__construct( 'MassEditRegex', 'masseditregex' );
}
 
+   /// Run the regexes.
function execute( $par ) {
-   global $wgUser, $wgRequest, $wgOut;
+   global $wgUser;
+
+   $wgOut = $this-getOutput();
 
$this-setHeaders();
 
-   # Check permissions
+   // Check permissions
if ( !$wgUser-isAllowed( 'masseditregex' ) ) {
$this-displayRestrictionError();
return;
}
 
-   # Show a message if the database is in read-only mode
+   // Show a message if the database is in read-only mode
if ( wfReadOnly() ) {
$wgOut-readOnlyPage();
return;
}
 
-   # If user is blocked, s/he doesn't need to access this page
+   // If user is blocked, s/he doesn't need to access this page
if ( $wgUser-isBlocked() ) {
$wgOut-blockedPage();
return;
@@ -62,16 +65,17 @@
 
$this-outputHeader();
 
+   $wgRequest = $this-getRequest();
$strPageList = $wgRequest-getText( 'wpPageList', 'Sandbox' );
$this-aPageList = explode(\n, trim($strPageList));
$this-strPageListType = $wgRequest-getText( 'wpPageListType', 
'pagenames' );
 
$this-iNamespace = $wgRequest-getInt( 'namespace', NS_MAIN );
 
-   $strMatch = $wgRequest-getText( 'wpMatch', '/hello (.*)\n/' );
-   $this-aMatch = explode(\n, trim($strMatch));
+   $this-strMatch = $wgRequest-getText( 'wpMatch', '/hello 
(.*)\n/' );
+   $this-aMatch = explode(\n, trim($this-strMatch));
 
-   $this-strReplace = $wgRequest-getText( 'wpReplace', 'goodbye 
\1' );
+   $this-strReplace = $wgRequest-getText( 'wpReplace', 'goodbye 
$1' );
$this-aReplace = explode(\n, $this-strReplace);
 
$this-strSummary = $wgRequest-getText( 'wpSummary', '' );
@@ -93,11 +97,7 @@
}
 
if ( $wgRequest-wasPosted() ) {
-   if ($wgRequest-getCheck( 'wpPreview' ) ) {
-   $this-showPreview();
-   } elseif (