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};
}