https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114404

Revision: 114404
Author:   catrope
Date:     2012-03-21 20:31:24 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
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: trunk/extensions/WikiLove/ApiWikiLove.php
===================================================================
--- trunk/extensions/WikiLove/ApiWikiLove.php   2012-03-21 20:30:46 UTC (rev 
114403)
+++ trunk/extensions/WikiLove/ApiWikiLove.php   2012-03-21 20:31:24 UTC (rev 
114404)
@@ -1,12 +1,9 @@
 <?php
 class ApiWikiLove extends ApiBase {
        public function execute() {
-               global $wgRequest, $wgWikiLoveLogging, $wgParser, $wgVersion;
+               global $wgRequest, $wgWikiLoveLogging, $wgParser;
 
                $params = $this->extractRequestParams();
-               
-               // In some cases we need the wiki mark-up stripped from the 
subject
-               $strippedSubject = $wgParser->stripSectionName( 
$params['subject'] );
 
                $title = Title::newFromText( $params['title'] );
                if ( is_null( $title ) ) {
@@ -22,37 +19,22 @@
                        $this->saveInDb( $talk, $params['subject'], 
$params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 );
                }
 
-               // MediaWiki did not allow specifying separate edit summaries 
and section titles until 1.19
-               $oldVersion = version_compare( $wgVersion, '1.18', '<=' );
-               if ( $oldVersion ) {
-                       $apiParamArray = array(
-                               'action' => 'edit',
-                               'title' => $talk->getFullText(),
-                               // need to do this, as Article::replaceSection 
fails for non-existing pages
-                               'appendtext' => ( $talk->exists() ? "\n\n" : '' 
) . 
-                                       wfMsgForContent( 
'newsectionheaderdefaultlevel', $params['subject'] )
-                                       . "\n\n" . $params['text'],
-                               'token' => $params['token'],
-                               'summary' => wfMsgForContent( 
'wikilove-summary', $strippedSubject ),
-                               'notminor' => true
-                       );
-               } else {
-                       $apiParamArray = array(
-                               'action' => 'edit',
-                               'title' => $talk->getFullText(),
-                               'section' => 'new',
-                               'sectiontitle' => $params['subject'],
-                               'text' => $params['text'],
-                               'token' => $params['token'],
-                               'summary' => wfMsgForContent( 
'wikilove-summary', $strippedSubject ),
-                               'notminor' => true
-                       );
-               }
-               
+               // not using section => 'new' here, as we like to give our own 
edit summary
                $api = new ApiMain(
                        new DerivativeRequest(
                                $wgRequest,
-                               $apiParamArray,
+                               array(
+                                       'action'     => 'edit',
+                                       'title'      => $talk->getFullText(),
+                                       // need to do this, as 
Article::replaceSection fails for non-existing pages
+                                       'appendtext' => ( $talk->exists() ? 
"\n\n" : '' ) . 
+                                               wfMsgForContent( 
'newsectionheaderdefaultlevel', $params['subject'] )
+                                               . "\n\n" . $params['text'],
+                                       'token'      => $params['token'],
+                                       'summary'    => wfMsgForContent( 
'wikilove-summary', 
+                                               $wgParser->stripSectionName( 
$params['subject'] ) ),
+                                       'notminor'   => true
+                               ),
                                false // was posted?
                        ),
                        true // enable write?
@@ -61,11 +43,11 @@
                $api->execute();
 
                if ( isset( $params['email'] ) ) {
-                       $this->emailUser( $talk, $strippedSubject, 
$params['email'], $params['token'] );
+                       $this->emailUser( $talk, $params['subject'], 
$params['email'], $params['token'] );
                }
 
                $this->getResult()->addValue( 'redirect', 'pageName', 
$talk->getPrefixedDBkey() );
-               $this->getResult()->addValue( 'redirect', 'fragment', 
Title::escapeFragmentForURL( $strippedSubject ) );
+               $this->getResult()->addValue( 'redirect', 'fragment', 
Title::escapeFragmentForURL( $params['subject'] ) );
                // note that we cannot use Title::makeTitle here as it doesn't 
sanitize the fragment
        }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to