r114404 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114403‎ | r114404 | r114405 >
Date:20:31, 21 March 2012
Author:catrope
Status:ok
Tags:
Comment:
Revert r113321, unreviewed.

All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
Modified paths:
  • /trunk/extensions/WikiLove/ApiWikiLove.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/ApiWikiLove.php
@@ -1,12 +1,9 @@
22 <?php
33 class ApiWikiLove extends ApiBase {
44 public function execute() {
5 - global $wgRequest, $wgWikiLoveLogging, $wgParser, $wgVersion;
 5+ global $wgRequest, $wgWikiLoveLogging, $wgParser;
66
77 $params = $this->extractRequestParams();
8 -
9 - // In some cases we need the wiki mark-up stripped from the subject
10 - $strippedSubject = $wgParser->stripSectionName( $params['subject'] );
118
129 $title = Title::newFromText( $params['title'] );
1310 if ( is_null( $title ) ) {
@@ -22,37 +19,22 @@
2320 $this->saveInDb( $talk, $params['subject'], $params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
2421 }
2522
26 - // MediaWiki did not allow specifying separate edit summaries and section titles until 1.19
27 - $oldVersion = version_compare( $wgVersion, '1.18', '<=' );
28 - if ( $oldVersion ) {
29 - $apiParamArray = array(
30 - 'action' => 'edit',
31 - 'title' => $talk->getFullText(),
32 - // need to do this, as Article::replaceSection fails for non-existing pages
33 - 'appendtext' => ( $talk->exists() ? "\n\n" : '' ) .
34 - wfMsgForContent( 'newsectionheaderdefaultlevel', $params['subject'] )
35 - . "\n\n" . $params['text'],
36 - 'token' => $params['token'],
37 - 'summary' => wfMsgForContent( 'wikilove-summary', $strippedSubject ),
38 - 'notminor' => true
39 - );
40 - } else {
41 - $apiParamArray = array(
42 - 'action' => 'edit',
43 - 'title' => $talk->getFullText(),
44 - 'section' => 'new',
45 - 'sectiontitle' => $params['subject'],
46 - 'text' => $params['text'],
47 - 'token' => $params['token'],
48 - 'summary' => wfMsgForContent( 'wikilove-summary', $strippedSubject ),
49 - 'notminor' => true
50 - );
51 - }
52 -
 23+ // not using section => 'new' here, as we like to give our own edit summary
5324 $api = new ApiMain(
5425 new DerivativeRequest(
5526 $wgRequest,
56 - $apiParamArray,
 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+ ),
5739 false // was posted?
5840 ),
5941 true // enable write?
@@ -61,11 +43,11 @@
6244 $api->execute();
6345
6446 if ( isset( $params['email'] ) ) {
65 - $this->emailUser( $talk, $strippedSubject, $params['email'], $params['token'] );
 47+ $this->emailUser( $talk, $params['subject'], $params['email'], $params['token'] );
6648 }
6749
6850 $this->getResult()->addValue( 'redirect', 'pageName', $talk->getPrefixedDBkey() );
69 - $this->getResult()->addValue( 'redirect', 'fragment', Title::escapeFragmentForURL( $strippedSubject ) );
 51+ $this->getResult()->addValue( 'redirect', 'fragment', Title::escapeFragmentForURL( $params['subject'] ) );
7052 // note that we cannot use Title::makeTitle here as it doesn't sanitize the fragment
7153 }
7254

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113321using sweet new 1.19 method! Bodacious! Also making sure that section headers...kaldari23:23, 7 March 2012

Status & tagging log