Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 38043
Status: resolved
Priority: 0/
Queue: MediaWiki-API

People
Owner: Nobody in particular
Requestors: stuart.caie [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.05
  • 0.06
  • 0.07
  • 0.08
  • 0.09
  • 0.10
Fixed in: (no value)



Subject: Cannot edit pages which don't exist
The edit() function cannot edit pages unless they already exist. It pays attention to the "missing" flag from the query action without even attempting the edit. The attached patch fixes this.
Subject: create_pages.diff
--- API.pm.orig 2008-07-30 14:26:14.000000000 +0100 +++ API.pm 2008-07-30 14:32:51.000000000 +0100 @@ -571,7 +571,7 @@ my ($pageid, $pageref) = each %{ $ref->{query}->{pages} }; - return $self->_error( ERR_EDIT, "Unable to $action page '$title'. Page does not exist.") if ( defined ( $pageref->{missing} ) ); + return $self->_error( ERR_EDIT, "Unable to $action page '$title'. Page does not exist.") if ( defined ( $pageref->{missing} ) && $action ne 'edit'); if ( $action eq 'rollback' ) { $query->{token} = @{ $pageref->{revisions} }[0]->{$action.'token'}; @@ -581,7 +581,7 @@ } # need timestamp of last revision for edits to avoid edit conflicts - if ( $action eq 'edit' ) { + if ( $action eq 'edit' && defined $pageref->{revisions}) { $query->{basetimestamp} = @{ $pageref->{revisions} }[0]->{timestamp}; }
Oops. terrible bug. Don't know how this one slipped through. Bad user testing on my part! Well, thanks very much for the patch. I have applied it/tested and everything should be fine in 1.12. the internal tokens thing is quite a mess, since there are different ways to get different tokens, even though most tokens are the same. But according to the API devs, they might not be in future.. ahh well.