r90017 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90016‎ | r90017 | r90018 >
Date:22:23, 13 June 2011
Author:janpaul123
Status:resolved (Comments)
Tags:
Comment:
Fixed problem: Edit Summary should mention WikiLove
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.api.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.api.php
@@ -1,7 +1,7 @@
22 <?php
33 class WikiLoveApi extends ApiBase {
44 public function execute() {
5 - global $wgRequest, $wgWikiLoveLogging;
 5+ global $wgRequest, $wgWikiLoveLogging, $wgParser;
66
77 $params = $this->extractRequestParams();
88
@@ -22,10 +22,9 @@
2323 $api = new ApiMain( new FauxRequest( array(
2424 'action' => 'edit',
2525 'title' => $talk->getFullText(),
26 - 'section' => 'new',
27 - 'text' => $params['text'],
 26+ 'text' => Article::newFromTitle( $talk, new RequestContext() )->replaceSection( 'new', $params['text'], $params['subject'] ),
2827 'token' => $params['token'],
29 - 'summary' => $params['subject'],
 28+ 'summary' => wfMsgForContent( 'wikilove-summary', $wgParser->stripSectionName( $params['subject'] ) ),
3029 'notminor' => true,
3130 ), false, array( 'wsEditToken' => $wgRequest->getSessionData( 'wsEditToken' ) ) ), true );
3231
Index: trunk/extensions/WikiLove/WikiLove.i18n.php
@@ -41,6 +41,7 @@
4242 'wikilove-err-sig' => 'Please do not include a signature in the message.',
4343 'wikilove-err-gallery' => 'Something went wrong when loading the images!',
4444 'wikilove-err-gallery-again' => 'Try again',
 45+ 'wikilove-summary' => '/* $1 */ new WikiLove message'
4546 );
4647
4748 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r90046Fixed r90017 per https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Specia...janpaul12314:39, 14 June 2011

Comments

#Comment by Catrope (talk | contribs)   13:32, 14 June 2011
-			'section' => 'new',
-			'text' => $params['text'],
+			'text' => Article::newFromTitle( $talk, new RequestContext() )->replaceSection( 'new', $params['text'], $params['subject'] ),
  • Please don't use RequestContext in this extension, that makes it undeployable (1.17wmf1 doesn't have RequestContext)
    • For creating an Article can't you still just use new Article( $title, 0 )  ?
  • You should add a comment explaining why you're doing this instead of using section=new. I only noticed when reading the code the third time (section name and summary differ by a wfMsgForContent() call)

OK otherwise.

Status & tagging log