r12156 - in /branches/upstream/libmediawiki-perl/current: Changes INSTALL META.yml README THANKS lib/MediaWiki.pm lib/MediaWiki/page.pm t/test04_history.t

gwolf at users.alioth.debian.org gwolf at users.alioth.debian.org
Mon Jan 7 17:36:42 UTC 2008


Author: gwolf
Date: Mon Jan  7 17:36:42 2008
New Revision: 12156

URL: http://svn.debian.org/wsvn/?sc=1&rev=12156
Log:
[svn-upgrade] Integrating new upstream version, libmediawiki-perl (1.13)

Modified:
    branches/upstream/libmediawiki-perl/current/Changes
    branches/upstream/libmediawiki-perl/current/INSTALL
    branches/upstream/libmediawiki-perl/current/META.yml
    branches/upstream/libmediawiki-perl/current/README
    branches/upstream/libmediawiki-perl/current/THANKS
    branches/upstream/libmediawiki-perl/current/lib/MediaWiki.pm
    branches/upstream/libmediawiki-perl/current/lib/MediaWiki/page.pm
    branches/upstream/libmediawiki-perl/current/t/test04_history.t

Modified: branches/upstream/libmediawiki-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/Changes?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/Changes (original)
+++ branches/upstream/libmediawiki-perl/current/Changes Mon Jan  7 17:36:42 2008
@@ -1,5 +1,11 @@
 Module MediaWiki changes log.
 -----------------------------------
+06.01.2008 - version 1.13
+minor feature enhancements
+* fixes in history functions.
+* small fix in switch().
+* added xblock() function.
+
 24.09.2007 - version 1.12
 minor bugfixes
 * fixed editToken regexes

Modified: branches/upstream/libmediawiki-perl/current/INSTALL
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/INSTALL?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/INSTALL (original)
+++ branches/upstream/libmediawiki-perl/current/INSTALL Mon Jan  7 17:36:42 2008
@@ -1,4 +1,4 @@
-Module Wikipedia 1.12 Installation Guide.
+Module Wikipedia 1.13 Installation Guide.
 ----------------------------------------------
 1.Requrements.
  This module requires the following modules:

Modified: branches/upstream/libmediawiki-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/META.yml?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/META.yml (original)
+++ branches/upstream/libmediawiki-perl/current/META.yml Mon Jan  7 17:36:42 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         MediaWiki
-version:      1.12
+version:      1.13
 version_from: lib/MediaWiki.pm
 installdirs:  site
 requires:

Modified: branches/upstream/libmediawiki-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/README?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/README (original)
+++ branches/upstream/libmediawiki-perl/current/README Mon Jan  7 17:36:42 2008
@@ -1,4 +1,4 @@
-The MediaWiki 1.12 Readme.
+The MediaWiki 1.13 Readme.
 
 The MediaWiki module provides high-level interface to MediaWiki
 content management system.

Modified: branches/upstream/libmediawiki-perl/current/THANKS
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/THANKS?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/THANKS (original)
+++ branches/upstream/libmediawiki-perl/current/THANKS Mon Jan  7 17:36:42 2008
@@ -1,8 +1,15 @@
-* Matthias Waldorf (Zoom) <matthias.waldorf at zoom.de>
-	upload without creating a tempfile
+* Matthias Waldorf <matthias.waldorf at zoom.de>
+	Upload without creating a tempfile
 
 * Max Cohan <max at endpoint.com>
 	SSL and http auth implementation
 
 * Tim Wilde <pause at krellis.org>
-	Help with some updates when wiki pages changed
+	Help with some updates when wiki pages changed
+
+* Jools Smith <buzz at exotica.org.uk>
+	Many bugfixes in history, pages editing etc.,
+	a lot of testing with new version of wiki engine.
+
+* Larry Pieniazek <lar at miltontrainworks.com>
+	Help with extended blocking implementation.

Modified: branches/upstream/libmediawiki-perl/current/lib/MediaWiki.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/lib/MediaWiki.pm?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/lib/MediaWiki.pm (original)
+++ branches/upstream/libmediawiki-perl/current/lib/MediaWiki.pm Mon Jan  7 17:36:42 2008
@@ -4,7 +4,7 @@
 @EXPORT = qw(ERR_NO_ERROR ERR_NO_INIHASH ERR_PARSE_INI ERR_NO_AUTHINFO ERR_NO_MSGCACHE ERR_LOGIN_FAILED ERR_LOOP ERR_NOT_FOUND);
 use strict;
 
-our($VERSION) = "1.12";
+our($VERSION) = "1.13";
 our($has_ini, $has_dumper);
 
 BEGIN
@@ -65,6 +65,7 @@
 			case => 'sensitive',
 			forValue => \&_ini_keycheck
 		);
+
 		return $mw->_error(ERR_PARSE_INI)
 			unless($cfg);
 	}
@@ -75,7 +76,7 @@
 	$mw->{ini} = $cfg;
 
 	my $proto = ($mw->_cfg("wiki", "ssl") ? "https:" : "http:");
-	$mw->{proto} = $proto; 
+	$mw->{proto} = $proto;
 
 	$mw->{index} = $proto . "//" . $mw->_cfg("wiki", "host") . "/" . $mw->_cfg("wiki", "path") . "/index.php";
 
@@ -151,6 +152,9 @@
 			if(!exists $wiki_cfg{$key});
 	}
 
+	$wiki_cfg{path} = ""
+		if(!$wiki_cfg{path});
+
 	$mw->setup({
 		'bot' => $mw->{ini}->{bot},
 		'wiki' => \%wiki_cfg,
@@ -196,12 +200,12 @@
 	$mw->{ini}->{bot}->{user} = $user;
 	$mw->{ini}->{bot}->{pass} = $pass;
 
-    if($realm) {
-
-        $mw->{ua}->credentials($mw->_cfg("wiki", "host").':'.($mw->_cfg("wiki", "ssl") ? "443" : "80"), $realm, $user, $pass );
-        $mw->{logged_in}->{$mw->{index}, $user} = 1;
-        return 1;
-    }
+	if($realm)
+	{
+		$mw->{ua}->credentials($mw->_cfg("wiki", "host").':'.($mw->_cfg("wiki", "ssl") ? "443" : "80"), $realm, $user, $pass );
+		$mw->{logged_in}->{$mw->{index}, $user} = 1;
+		return 1;
+	}
 
 	my $res = $mw->{ua}->request(
 		POST $mw->{index} . "?title=Special:Userlogin&action=submitlogin",
@@ -462,7 +466,12 @@
 sub block
 {
 	my($mw, $user, $time) = @_;
-	return $mw->get("User:$user", "")->block($time);
+	return $mw->get("User:$user", "")->xblock($time, 1, 1, 1);
+}
+sub xblock
+{
+	my($mw, $user, $time, $anonOnly, $createAccount, $enableAutoblock) = @_;
+	return $mw->get("User:$user", "")->xblock($time, $anonOnly, $createAccount, $enableAutoblock);
 }
 sub unblock
 {
@@ -505,6 +514,7 @@
  $is_ok = $c->upload("image_name", `cat myfoto.jpg`, "some notes", $force);
 
  $is_ok = $c->block("VasyaPupkin", "2 days");
+ $is_ok = $c->xblock("SomeBadBot", "2 weeks", 0, 1, 0);
  $is_ok = $c->unblock("VasyaPupkin");
 
  $c->{summary} = "Automatic auto-replacements 1.2";
@@ -541,6 +551,7 @@
  $is_ok = $pg->upload(`cat myfoto.jpg`, "some notes", $force);
 
  $is_ok = $pg->block("2 days");
+ $is_ok = $pg->xblock("3 days", 0, 1, 0);
  $is_ok = $pg->unblock();
 
  $pg->history(sub { my $edit_p = shift; } );
@@ -674,11 +685,27 @@
  [0-9]+ (seconds|minutes|hours|days|months|years)
 or in L<ctime> format.
 
+Equal to $c->xblock($user_name, $block_time, 1, 1, 1) call (see below).
+
 B<Note>: this operation requires sysop rights.
 
+=head3 $c->xblock($user_name, $block_time, $anonOnly, $createAccount, $enableAutoblock)
+
+Extended blocking, does the same as block() except for the following:
+1. if anonOnly is 1 and we're blocking an IP, registered users who edit from this IP
+aren't affected
+2. if createAccount is 0, it's not allowed to register new accounts from this IP
+3. if enableAutoblock is 1 and we're blocking a registered user, the IP used by
+this user is also blocked (it remains hidden in blocks log, however).
+See http://meta.wikimedia.org/wiki/Help:Block_and_unblock for more info.
+
+B<Note>: this operation requires sysop rights.
+
 =head3 $c->unblock($user_name)
 
 Unblocks specified user.
+
+B<Note>: this operation requires sysop rights.
 
 B<Note>: this operation requires sysop rights.
 
@@ -803,7 +830,11 @@
 
 See $c->block
 
-=head3 $pg->unblock()
+=head3 $pg->block($block_time)
+
+See $c->xblock
+
+=head3 $pg->unblock($block_time, $anonOnly, $createAccount, $enableAutoblock)
 
 See $c->unblock
 

Modified: branches/upstream/libmediawiki-perl/current/lib/MediaWiki/page.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/lib/MediaWiki/page.pm?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/lib/MediaWiki/page.pm (original)
+++ branches/upstream/libmediawiki-perl/current/lib/MediaWiki/page.pm Mon Jan  7 17:36:42 2008
@@ -32,6 +32,7 @@
 	$oldid_regex
 	$offset_regex
 	$permission_error_regex
+	$numbersonly_regex
 );
 our @protection = ("", "autoconfirmed", "sysop");
 
@@ -47,8 +48,8 @@
 	$edittime_regex = qr/(?<=value=["'])[0-9]+(?=["'] name=["']wpEdittime["'])/;
 	$watchthis_regex = qr/name=["']wpWatchthis["'] checked/;
 	$minoredit_regex = qr/(?<=value=["'])1(?=["'] name=["']wpMinoredit["'])/;
-	$edittoken_regex = qr/(?<=value=["'])[0-9a-f+]*\\?(?=["'] name=["']wpEditToken["'])/;
-	$edittoken_rev_regex = qr/(?<=name=['"]wpEditToken['"] value=["'])[0-9a-f+]+\\?(?=["'])/;
+	$edittoken_regex = qr/(?<=value=["'])[0-9a-f]*\+?\\?(?=["'] name=["']wpEditToken["'])/;
+	$edittoken_rev_regex = qr/(?<=name=['"]wpEditToken['"] value=["'])[0-9a-f]+\+?\\?(?=["'])/;
 	$autosumm_regex = qr/(?<=name=["']wpAutoSummary["'] value=["'])[0-9a-f]+(?=["'])/;
 	$edittoken_delete_regex = qr/^.*wpEditToken["'][^>]*?value=["'](.*?)["'].*$/s;
 	$pagehistory_delete_regex = qr/.*<ul id\=["']pagehistory["']>(.*?)<\/ul>.*/;
@@ -74,6 +75,7 @@
 
 	$oldid_regex = qr/(?<=&amp;oldid=)[0-9]+(?=["'])/;
 	$offset_regex = qr/(?<=offset=)[0-9]+/;
+	$numbersonly_regex = qr/.*?([0-9]+).*/;
 
 	# TODO: compile this only if admin interface enabled in bot.ini
 	$permission_error_regex = qr/<h1 class="firstHeading">Permission error<\/h1>/;
@@ -287,7 +289,7 @@
 sub _summary
 {
 	my $obj = shift;
-	return $obj->{summary} || $obj->{client}->{summary} || "Bot (Edward's framework)";
+	return $obj->{summary} || $obj->{client}->{summary} || "Edit via perl MediaWiki framework ($MediaWiki::VERSION)";
 }
 
 sub delete
@@ -503,9 +505,9 @@
 	return $obj->{ua}->get($path)->content();
 }
 
-sub block
-{
-	my($obj, $time) = @_;
+sub xblock
+{
+	my($obj, $time, $anonOnly, $createAccount, $enableAutoblock) = @_;
 	my $user = $obj->_pagename();
 
 	if(!$obj->{prepared})
@@ -527,9 +529,17 @@
 			'wpBlockOther' => $time,
 			'wpBlockReason' => $obj->_summary(),
 			'wpEditToken' => $obj->{edittoken},
-			'wpBlock' => 'Block'
+			'wpBlock' => 'Block',
+			'wpAnonOnly' => $anonOnly,
+			'wpCreateAccount' => $createAccount,
+			'wpEnableAutoblock' => $enableAutoblock,
 		)]
 	)->code == 302;
+}
+sub block
+{
+	my($obj, $time) = @_;
+	return $obj->xblock($time, 1, 1, 1);
 }
 sub unblock
 {
@@ -578,7 +588,7 @@
 {
 	my($obj, $offset) = @_;
 	my $page = $obj->{title}; my $pageq = quotemeta($page);
-	my $limit = $obj->{client}->{history_step} || 50;
+	my $limit = $obj->{history_step} || 50;
 
 	my $wiki_path = $obj->{client}->_cfg("wiki", "path");
 	my $link_regex2 = qr/<a href=['"]\/$wiki_path\/index\.php(?:\/|\?title=)(.*?)\&.*?['"]>(.*?)<\/a>/;
@@ -595,6 +605,8 @@
 		my $match = $&;
 		$match =~ /$offset_regex/;
 		$offset = $match;
+
+		$offset =~ s/$numbersonly_regex/$1/g;
 	}
 	else
 	{

Modified: branches/upstream/libmediawiki-perl/current/t/test04_history.t
URL: http://svn.debian.org/wsvn/branches/upstream/libmediawiki-perl/current/t/test04_history.t?rev=12156&op=diff
==============================================================================
--- branches/upstream/libmediawiki-perl/current/t/test04_history.t (original)
+++ branches/upstream/libmediawiki-perl/current/t/test04_history.t Mon Jan  7 17:36:42 2008
@@ -16,10 +16,11 @@
 	while($i < 3)
 	{
 		my $pg = $c->random();
+		$pg->{history_step} = 1;
 		my $e = $pg->last_edit;
 		if($e->{user} ne $user)
 		{
-			$pg->{content} = "Hello, World! (Bot test; do not consider as vandalism - should be reverted)";
+			$pg->{content} = "Hello, World! (Bot test; should be reverted in about one minute)";
 			$pg->{summary} = "Test of [[m:MediaWiki (perl)|MediaWiki]] perl module (4)";
 			$pg->save();
 			$e = $pg->last_edit;




More information about the Pkg-perl-cvs-commits mailing list