r55842 - in /branches/upstream/libmediawiki-api-perl/current: Changes META.yml README lib/MediaWiki/API.pm

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Apr 10 08:30:43 UTC 2010


Author: ansgar-guest
Date: Sat Apr 10 08:30:35 2010
New Revision: 55842

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

Modified:
    branches/upstream/libmediawiki-api-perl/current/Changes
    branches/upstream/libmediawiki-api-perl/current/META.yml
    branches/upstream/libmediawiki-api-perl/current/README
    branches/upstream/libmediawiki-api-perl/current/lib/MediaWiki/API.pm

Modified: branches/upstream/libmediawiki-api-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmediawiki-api-perl/current/Changes?rev=55842&op=diff
==============================================================================
--- branches/upstream/libmediawiki-api-perl/current/Changes (original)
+++ branches/upstream/libmediawiki-api-perl/current/Changes Sat Apr 10 08:30:35 2010
@@ -1,7 +1,15 @@
 Revision history for MediaWiki-API
 
+0.30    2010-04-08
+        MediaWiki >= 1.15.3 and MediaWiki >= 1.16.0beta2 now require a login token to be sent when logging in. Please
+        see https://bugzilla.wikimedia.org/show_bug.cgi?id=23076 for more details. The MediaWiki::API login method is
+        now adjusted to handle this automatically. Thanks to Brent Garber for the heads up and the patch which I used
+        with some minor modifications.
+
 0.29    2010-01-10
-        Module will now use any proxy settings if set in the environment. To force the module not to use a proxy even if set there is a new configuration option MediaWiki::API->{config}->{noproxy} that can be set.
+        Module will now use any proxy settings if set in the environment. To force the module not to use a proxy even
+        if set there is a new configuration option MediaWiki::API->{config}->{noproxy} that can be set. Thanks to
+        Andy Jenkinson for the suggestion and patch.
 
 0.28    2009-09-09
         The skip_encoding option was ignored for the list function. Thanks to Estelle for reporting the problem.
@@ -59,7 +67,6 @@
         $mw->{config}->{on_error}.
 
         Improved http error messages. 
-
 
 0.17    2008-10-30
         My understanding on the way rollback worked was flawed. The rollback call always rolled back the last users edit 

Modified: branches/upstream/libmediawiki-api-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmediawiki-api-perl/current/META.yml?rev=55842&op=diff
==============================================================================
--- branches/upstream/libmediawiki-api-perl/current/META.yml (original)
+++ branches/upstream/libmediawiki-api-perl/current/META.yml Sat Apr 10 08:30:35 2010
@@ -1,18 +1,26 @@
 --- #YAML:1.0
-name:                MediaWiki-API
-version:             0.29
-abstract:            Provides a Perl interface to the MediaWiki API (http://www.mediawiki.org/wiki/API)
-license:             GPL-3+
-author:              
+name:               MediaWiki-API
+version:            0.30
+abstract:           Provides a Perl interface to the MediaWiki API (http://www.mediawiki.org/wiki/API)
+author:
     - Jools Wills <buzz at exotica.org.uk>
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-    Carp:                          0
-    Encode:                        0
-    JSON:                          0
-    LWP::UserAgent:                0
-    Test::More:                    0
+license:            GPL-3+
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    Carp:            0
+    Encode:          0
+    JSON:            0
+    LWP::UserAgent:  0
+    Test::More:      0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libmediawiki-api-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmediawiki-api-perl/current/README?rev=55842&op=diff
==============================================================================
--- branches/upstream/libmediawiki-api-perl/current/README (original)
+++ branches/upstream/libmediawiki-api-perl/current/README Sat Apr 10 08:30:35 2010
@@ -24,6 +24,9 @@
     make install
 
 CREATING DEBIAN PACKAGE / INSTALLING ON DEBIAN
+
+Please note that Debian squeeze and Ubuntu Karmic already have a package
+with this module.
 
 Note that this module requires the packages libwww-perl, libjson-perl, and
 optionally libjson-xs-perl for faster JSON decoding.

Modified: branches/upstream/libmediawiki-api-perl/current/lib/MediaWiki/API.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmediawiki-api-perl/current/lib/MediaWiki/API.pm?rev=55842&op=diff
==============================================================================
--- branches/upstream/libmediawiki-api-perl/current/lib/MediaWiki/API.pm (original)
+++ branches/upstream/libmediawiki-api-perl/current/lib/MediaWiki/API.pm Sat Apr 10 08:30:35 2010
@@ -40,11 +40,11 @@
 
 =head1 VERSION
 
-Version 0.29
-
-=cut
-
-our $VERSION  = "0.29";
+Version 0.30
+
+=cut
+
+our $VERSION  = "0.30";
 
 =head1 SYNOPSIS
 
@@ -201,7 +201,7 @@
 
 =head2 MediaWiki::API->login( $query_hashref )
 
-Logs in to a MediaWiki. Parameters are those used by the MediaWiki API (http://www.mediawiki.org/wiki/API:Login). Returns a hashref with some login details, or undef on login failure. Errors are stored in MediaWiki::API->{error}->{code} and MediaWiki::API->{error}->{details}.
+Logs in to a MediaWiki. Parameters are those used by the MediaWiki API (http://www.mediawiki.org/wiki/API:Login). Returns a hashref with some login details, or undef on login failure. If Mediawiki sends requests a LoginToken the login is attempted again, but with the token sent from the initial login. Errors are stored in MediaWiki::API->{error}->{code} and MediaWiki::API->{error}->{details}.
 
   my $mw = MediaWiki::API->new( { api_url => 'http://en.wikipedia.org/w/api.php' }  );
 
@@ -219,9 +219,20 @@
 
   # reassign hash reference to the login section
   my $login = $ref->{login};
+
+  # Do login token checking
+  if ( $login->{result} eq 'NeedToken' ) {
+    my $token = $login->{token};
+    $query->{lgtoken} = $token;
+    # Re-submit previous request with token
+    return undef unless ( $ref = $self->api( $query ) );
+    $login = $ref->{login};
+  }
+
+  # return error if the login was not successful
   return $self->_error( ERR_LOGIN, 'Login Failure - ' . $login->{result} )
     unless ( $login->{result} eq 'Success' );
-
+    
   # everything was ok so return the reference
   return $login;
 }




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