Index: trunk/extensions/WikiLove/ApiWikiLove.php |
— | — | @@ -20,16 +20,25 @@ |
21 | 21 | } |
22 | 22 | |
23 | 23 | // not using section => 'new' here, as we like to give our own edit summary |
24 | | - $api = new ApiMain( new FauxRequest( array( |
25 | | - 'action' => 'edit', |
26 | | - 'title' => $talk->getFullText(), |
27 | | - // need to do this, as Article::replaceSection fails for non-existing pages |
28 | | - 'appendtext' => ( $talk->exists() ? "\n\n" : '' ) . wfMsgForContent( 'newsectionheaderdefaultlevel', $params['subject'] ) |
29 | | - . "\n\n" . $params['text'], |
30 | | - 'token' => $params['token'], |
31 | | - 'summary' => wfMsgForContent( 'wikilove-summary', $wgParser->stripSectionName( $params['subject'] ) ), |
32 | | - 'notminor' => true, |
33 | | - ), false, array( 'wsEditToken' => $wgRequest->getSessionData( 'wsEditToken' ) ) ), true ); |
| 24 | + $api = new ApiMain( |
| 25 | + new DerivativeRequest( |
| 26 | + $wgRequest, |
| 27 | + array( |
| 28 | + 'action' => 'edit', |
| 29 | + 'title' => $talk->getFullText(), |
| 30 | + // need to do this, as Article::replaceSection fails for non-existing pages |
| 31 | + 'appendtext' => ( $talk->exists() ? "\n\n" : '' ) . |
| 32 | + wfMsgForContent( 'newsectionheaderdefaultlevel', $params['subject'] ) |
| 33 | + . "\n\n" . $params['text'], |
| 34 | + 'token' => $params['token'], |
| 35 | + 'summary' => wfMsgForContent( 'wikilove-summary', |
| 36 | + $wgParser->stripSectionName( $params['subject'] ) ), |
| 37 | + 'notminor' => true |
| 38 | + ), |
| 39 | + false // was posted? |
| 40 | + ), |
| 41 | + true // enable write? |
| 42 | + ); |
34 | 43 | |
35 | 44 | $api->execute(); |
36 | 45 | |