https://bugzilla.wikimedia.org/show_bug.cgi?id=19677
Summary: Stack dump with errors when trying to create pages
through the API
Product: MediaWiki
Version: 1.15.0
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: Normal
Component: API
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
I'm writing an extension that will create pages through the API based on user
input. When the code that creates the page is executed, I'm getting a stack
dump:
Unexpected non-MediaWiki exception encountered, of type "UsageException"
noapiwrite: Editing of this wiki through the API is disabled. Make sure the
$wgEnableWriteAPI=true; statement is included in the wiki's LocalSettings.php
file
#0 /Users/lhridley/MediaWiki1_15/phase3/includes/api/ApiBase.php(830):
ApiBase->dieUsage('Editing of this...', 'noapiwrite')
#1 /Users/lhridley/MediaWiki1_15/phase3/includes/api/ApiMain.php(395):
ApiBase->dieUsageMsg(Array)
#2 /Users/lhridley/MediaWiki1_15/phase3/includes/api/ApiMain.php(220):
ApiMain->executeAction()
#3
/Users/lhridley/MediaWiki1_15/phase3/extensions/ProjectWiki/ProjectWiki.php(231):
ApiMain->execute()
#4
/Users/lhridley/MediaWiki1_15/phase3/extensions/ProjectWiki/ProjectWiki.php(117):
ProjectSetup::createPage('Test Project', 'category', Array)
#5 [internal function]: ProjectSetup::attemptSave(Object(EditPage))
#6 /Users/lhridley/MediaWiki1_15/phase3/includes/Hooks.php(117):
call_user_func_array(Array, Array)
#7 /Users/lhridley/MediaWiki1_15/phase3/includes/EditPage.php(749):
wfRunHooks('EditPage::attem...', Array)
#8 /Users/lhridley/MediaWiki1_15/phase3/includes/EditPage.php(2483):
EditPage->internalAttemptSave(false, false)
#9 /Users/lhridley/MediaWiki1_15/phase3/includes/EditPage.php(449):
EditPage->attemptSave()
#10 /Users/lhridley/MediaWiki1_15/phase3/includes/EditPage.php(340):
EditPage->edit()
#11 /Users/lhridley/MediaWiki1_15/phase3/includes/Wiki.php(510):
EditPage->submit()
#12 /Users/lhridley/MediaWiki1_15/phase3/includes/Wiki.php(63):
MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title),
Object(User), Object(WebRequest))
#13 /Users/lhridley/MediaWiki1_15/phase3/index.php(116):
MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage),
Object(User), Object(WebRequest))
#14 {main}
The problem is that $wgEnableAPI is set to true, $wgEnableWriteAPI is set to
true, and the user groups all have the writeapi permission.
It appears that the $wgEnableWriteAPI flag is being ignored when the APIMain
object is created. The code in the extension that attempts to create the
object is as follows:
$pageparams = array(
'action' => 'edit',
'section' => 0,
'token' => $pageinfo['edittoken'],
'summary' => 'Project Setup: Creating New Project
pages for ' . $projectName,
'starttimestamp' => $pageinfo['starttimestamp'],
'title' => $pageinfo['title']
);
if($pagetype == 'category') {
$pageparams['text'] = 'Listed below are all pages that
are part of the ' . $projectName . ' project. ';
}
if($pagetype == 'issuetracker') {
$pageparams['text'] = '<issues
project="'.$projectName.'" />
[[Category:'.$projectName.' Project|{{BASEPAGENAME}}]]
';
}
$params = new FauxRequest($pageparams);
$api = new ApiMain($params);
$api->execute();
The error is occurring upon $api->execute();
--
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