r85802 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85801‎ | r85802 | r85803 >
Date:17:02, 11 April 2011
Author:tparscal
Status:ok
Tags:
Comment:
Removed redundant missing param error information and fixes the mess that was the schema updater. Resolves issue in r85707.
Modified paths:
  • /trunk/extensions/EmailCapture/EmailCaptureHooks.php (modified) (history)
  • /trunk/extensions/EmailCapture/api/ApiEmailCapture.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EmailCapture/EmailCaptureHooks.php
@@ -7,24 +7,15 @@
88 * LoadExtensionSchemaUpdates hook
99 */
1010 public static function loadExtensionSchemaUpdates( $updater = null ) {
11 - if ( $updater === null ) {
12 - global $wgExtNewTables;
13 - $wgExtNewTables[] = array(
 11+ $dir = dirname( __FILE__ );
 12+ $db = $updater->getDB();
 13+ if ( !$db->tableExists( 'email_capture' ) ) {
 14+ // Initial install tables
 15+ $updater->addExtensionUpdate( array(
 16+ 'addTable',
1417 'email_capture',
1518 dirname( __FILE__ ) . '/sql/CreateEmailCaptureTable.sql'
1619 );
17 - } else {
18 - $dir = dirname( __FILE__ );
19 - $db = $updater->getDB();
20 - if ( !$db->tableExists( 'email_capture' ) ) {
21 - // Initial install tables
22 - $updater->addExtensionUpdate( array(
23 - 'addTable',
24 - 'email_capture',
25 - $dir . '/sql/CreateEmailCaptureTable.sql',
26 - true
27 - ) );
28 - }
2920 }
3021 return true;
3122 }
Index: trunk/extensions/EmailCapture/api/ApiEmailCapture.php
@@ -9,9 +9,7 @@
1010 $params = $this->extractRequestParams();
1111
1212 // Validation
13 - if ( !isset( $params['email'] ) ) {
14 - $this->dieUsageMsg( array( 'missingparam', 'email' ) );
15 - } elseif ( !User:isValidEmailAddr( $params['email'] ) ) {
 13+ if ( !User:isValidEmailAddr( $params['email'] ) ) {
1614 $this->dieUsage( 'The email address does not appear to be valid', 'invalidemail' );
1715 }
1816
@@ -90,7 +88,6 @@
9189
9290 public function getPossibleErrors() {
9391 return array_merge( parent::getPossibleErrors(), array(
94 - array( 'missingparam', 'email' ),
9592 array(
9693 'code' => 'invalidemail',
9794 'info' => 'The email address does not appear to be valid'

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85707Creating new extension for collecting and verifying email addresses. This cod...tparscal00:40, 9 April 2011

Status & tagging log