r12158 - in /trunk/libmediawiki-perl: Changes INSTALL META.yml README THANKS debian/changelog debian/control 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:42:23 UTC 2008
Author: gwolf
Date: Mon Jan 7 17:42:23 2008
New Revision: 12158
URL: http://svn.debian.org/wsvn/?sc=1&rev=12158
Log:
New upstream version
Modified:
trunk/libmediawiki-perl/Changes
trunk/libmediawiki-perl/INSTALL
trunk/libmediawiki-perl/META.yml
trunk/libmediawiki-perl/README
trunk/libmediawiki-perl/THANKS
trunk/libmediawiki-perl/debian/changelog
trunk/libmediawiki-perl/debian/control
trunk/libmediawiki-perl/lib/MediaWiki.pm
trunk/libmediawiki-perl/lib/MediaWiki/page.pm
trunk/libmediawiki-perl/t/test04_history.t
Modified: trunk/libmediawiki-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/Changes?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/Changes (original)
+++ trunk/libmediawiki-perl/Changes Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/INSTALL
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/INSTALL?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/INSTALL (original)
+++ trunk/libmediawiki-perl/INSTALL Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/META.yml?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/META.yml (original)
+++ trunk/libmediawiki-perl/META.yml Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/README
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/README?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/README (original)
+++ trunk/libmediawiki-perl/README Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/THANKS
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/THANKS?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/THANKS (original)
+++ trunk/libmediawiki-perl/THANKS Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/debian/changelog?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/debian/changelog (original)
+++ trunk/libmediawiki-perl/debian/changelog Mon Jan 7 17:42:23 2008
@@ -1,3 +1,11 @@
+libmediawiki-perl (1.13-1) unstable; urgency=low
+
+ * New upstream release
+ * Bumped up standards-version to 3.7.3 (No chnages needed)
+ * Added myself to uploaders
+
+ -- Gunnar Wolf <gwolf at debian.org> Mon, 07 Jan 2008 11:38:50 -0600
+
libmediawiki-perl (1.12-1) unstable; urgency=low
[ Michael Mende ]
Modified: trunk/libmediawiki-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/debian/control?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/debian/control (original)
+++ trunk/libmediawiki-perl/debian/control Mon Jan 7 17:42:23 2008
@@ -7,8 +7,9 @@
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Michael Mende <debian at menole.net>,
David Paleino <d.paleino at gmail.com>,
- Damyan Ivanov <dmn at debian.org>
-Standards-Version: 3.7.2
+ Damyan Ivanov <dmn at debian.org>,
+ Gunnar Wolf <gwolf at debian.org>
+Standards-Version: 3.7.3
Homepage: http://search.cpan.org/dist/MediaWiki/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libmediawiki-perl/
Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libmediawiki-perl/
Modified: trunk/libmediawiki-perl/lib/MediaWiki.pm
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/lib/MediaWiki.pm?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/lib/MediaWiki.pm (original)
+++ trunk/libmediawiki-perl/lib/MediaWiki.pm Mon Jan 7 17:42:23 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: trunk/libmediawiki-perl/lib/MediaWiki/page.pm
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/lib/MediaWiki/page.pm?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/lib/MediaWiki/page.pm (original)
+++ trunk/libmediawiki-perl/lib/MediaWiki/page.pm Mon Jan 7 17:42:23 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/(?<=&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: trunk/libmediawiki-perl/t/test04_history.t
URL: http://svn.debian.org/wsvn/trunk/libmediawiki-perl/t/test04_history.t?rev=12158&op=diff
==============================================================================
--- trunk/libmediawiki-perl/t/test04_history.t (original)
+++ trunk/libmediawiki-perl/t/test04_history.t Mon Jan 7 17:42:23 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