https://bugzilla.wikimedia.org/show_bug.cgi?id=18920
Summary: Wikimedia error from POST
Product: MediaWiki
Version: 1.15-svn
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Normal
Component: API
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Created an attachment (id=6153)
--> (https://bugzilla.wikimedia.org/attachment.cgi?id=6153)
response from Wikibot
I use Wikibot (http://en.wikipedia.org/wiki/User:LivingBot/Wikibot.php5) in my
script Test.php:
<source lang="php">
<?php
//grab class
include('Wikibot.php5');
//get user&password
$fhUP = fopen("user&password.txt", 'r') or die("Can't open user&password
file");
$username = rtrim(fgets($fhUP));
$password = rtrim(fgets($fhUP));
fclose($fhUP);
// open file with page names
$fhPN = fopen("page_names.txt", 'r') or die("Can't open page_names file");
//create bot
$wiki = "en";
$MyBot = new Wikibot($username, $password, $wiki);
// get first page
$pagename = rtrim(fgets($fhPN));
// process page names
$i = 0;
echo "\n";
while (!feof($fhPN))
{
echo "\nPage " . ++$i . " [[" . $wiki . ":" . $pagename . "]]\n";
$page = $MyBot->get_page($pagename);
$out = $MyBot->edit_page($pagename,$page."<br><br>Test ".date("Y-m-d
H:i:s"),"test",false,false);
// next page
$pagename = rtrim(fgets($fhPN));
}
fclose($fhPN);
?>
</source>
File page_names.txt contains two lines: User:Ency/test1 and User:Ency/test2.
Execute
# php Test.php
gives right result with 1st page and for a while obscure with 2nd:
Page 1 [[en:User:Ency/test1]]
Successfully edited User:Ency/test1.<br />
Page 2 [[en:User:Ency/test2]]
Error - <br />
^^^ Error with put_page called from edit_page.<br />
I found that Wikibot in 221 line ($response = curl_exec($ch);) gives such
$response for 1st page:
a:1:{s:4:"edit";a:5:s:6:"result";s:7:"Success";s:6:"pageid";i:22950702;s:5:"title";s:15:"User:Ency/test1";s:8:"oldrevid";i:292303690;s:8:"newrevid";i:292303840;}}
and for 2nd only html standard error page (see attachment 2nd_response.html),
which is returned after unserialize as empty array.
Is it a API bug in 2nd case?
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l