r86396 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86395‎ | r86396 | r86397 >
Date:14:22, 19 April 2011
Author:catrope
Status:ok
Tags:
Comment:
EmailCapture fixes (also untested):
* Fix indices in SQL schema (PRIMARY KEY instead of one-field UNIQUE INDEX, and fix index naming)
* Fix parameter order for body message, was wrong
* Use getFullUrl() instead of link(). The previous code was wrong because
** link() wants a Title, not a string, so it would just return <!-- ERROR -->Special:EmailCapture
** even if called right, it would return an HTML <a> tag, and you're sending the e-mail as text/plain
** using getTitleFor() also produces nice localized special page titles
* Add aliases file
Modified paths:
  • /trunk/extensions/EmailCapture/EmailCapture.alias.php (added) (history)
  • /trunk/extensions/EmailCapture/EmailCapture.php (modified) (history)
  • /trunk/extensions/EmailCapture/api/ApiEmailCapture.php (modified) (history)
  • /trunk/extensions/EmailCapture/sql/CreateEmailCaptureTable.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/EmailCapture/sql/CreateEmailCaptureTable.sql
@@ -1,7 +1,7 @@
22 -- Captured email addresses
33 CREATE TABLE IF NOT EXISTS /*_*/email_capture (
44 -- Email address
5 - ec_email varbinary(255) NOT NULL DEFAULT '',
 5+ ec_email varbinary(255) PRIMARY KEY NOT NULL DEFAULT '',
66 -- Additional information
77 ec_info blob NOT NULL DEFAULT '',
88 -- Verification code
@@ -9,5 +9,4 @@
1010 -- Verified
1111 ec_verified boolean DEFAULT 0
1212 ) /*$wgDBTableOptions*/;
13 -CREATE UNIQUE INDEX /*i*/ac_email_key ON /*_*/email_capture (ec_email);
14 -CREATE INDEX /*i*/ac_code_verified_key ON /*_*/email_capture (ec_code, ec_verified);
 13+CREATE INDEX /*i*/ec_code_verified ON /*_*/email_capture (ec_code, ec_verified);
Index: trunk/extensions/EmailCapture/EmailCapture.php
@@ -38,6 +38,7 @@
3939 /* Setup */
4040 $dir = dirname( __FILE__ ) . '/';
4141 $wgExtensionMessagesFiles['EmailCapture'] = $dir . 'EmailCapture.i18n.php';
 42+$wgExtensionAliasesFiles['EmailCapture'] = $dir . 'EmailCapture.alias.php';
4243 // API
4344 $wgAutoloadClasses['ApiEmailCapture'] = $dir . 'api/ApiEmailCapture.php';
4445 $wgAPIModules['emailcapture'] = 'ApiEmailCapture';
Index: trunk/extensions/EmailCapture/EmailCapture.alias.php
@@ -0,0 +1,16 @@
 2+<?php
 3+/**
 4+ * Special page aliases for EmailCapture extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$specialPageAliases = array();
 11+
 12+/** English (English)
 13+ * @author Roan Kattouw
 14+ */
 15+$specialPageAliases['en'] = array(
 16+ 'EmailCapture' => array( 'EmailCapture' ),
 17+);
Property changes on: trunk/extensions/EmailCapture/EmailCapture.alias.php
___________________________________________________________________
Added: svn:eol-style
118 + native
Index: trunk/extensions/EmailCapture/api/ApiEmailCapture.php
@@ -32,10 +32,9 @@
3333 if ( $dbw->affectedRows() ) {
3434 // Send auto-response
3535 global $wgUser, $wgEmailCaptureSendAutoResponse, $wgEmailCaptureAutoResponse;
36 - $link = $wgUser->getSkin()->link( 'Special:EmailCapture' );
37 - $fullLink = $wgUser->getSkin()->link(
38 - 'Special:EmailCapture', null, array(), array( 'verify' => $code )
39 - );
 36+ $title = SpecialPage::getTitleFor( 'EmailCapture' );
 37+ $link = $title->getFullURL();
 38+ $fullLink = $title->getFullURL( array( 'verify' => $code ) );
4039 if ( $wgEmailCaptureSendAutoResponse ) {
4140 UserMailer::send(
4241 new MailAddress( $params['email'] ),
@@ -44,7 +43,7 @@
4544 $wgEmailCaptureAutoResponse['from-name']
4645 ),
4746 wfMsg( $wgEmailCaptureAutoResponse['subject-msg'] ),
48 - wfMsg( $wgEmailCaptureAutoResponse['body-msg'], $link, $code, $fullLink ),
 47+ wfMsg( $wgEmailCaptureAutoResponse['body-msg'], $fullLink, $link, $code ),
4948 $wgEmailCaptureAutoResponse['reply-to'],
5049 $wgEmailCaptureAutoResponse['content-type']
5150 );

Status & tagging log