r95701 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95700‎ | r95701 | r95702 >
Date:21:23, 29 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
SignupAPI: Using the configuration directly instead of a hook
* Kept the hook for other uses though.
* Removed onSignupAPIUseAjax() and instead put the check in SpecialUserSignup->execute()
* This also solves half of bug 30622.
* Fix E_NOTICE error, Methods in SignupAPI.hooks.php should be static.
Modified paths:
  • /trunk/extensions/SignupAPI/SignupAPI.php (modified) (history)
  • /trunk/extensions/SignupAPI/includes/SignupAPI.hooks.php (modified) (history)
  • /trunk/extensions/SignupAPI/includes/SpecialUserSignup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SignupAPI/SignupAPI.php
@@ -67,10 +67,6 @@
6868
6969 # Hooks
7070
71 -if ( $wgSignupAPIUseAjax ) {
72 - $wgHooks['SignupForm'][] = 'SignupAPIHooks::onSignupAPIUseAjax';
73 -}
74 -
7571 if ( $wgSignupAPISourceTracking ) {
7672
7773 // Schema updates for update.php
Index: trunk/extensions/SignupAPI/includes/SignupAPI.hooks.php
@@ -8,13 +8,7 @@
99
1010 class SignupAPIHooks {
1111
12 - function onSignupAPIUseAjax() {
13 - global $wgOut;
14 - $wgOut->addModules( 'ext.SignupAPI' );
15 - return true;
16 - }
17 -
18 - function onSourceTracking() {
 12+ static function onSourceTracking() {
1913 global $wgExtNewTables;
2014
2115 $wgExtNewTables[] = array(
@@ -24,7 +18,7 @@
2519 return true;
2620 }
2721
28 - function addSourceTracking( &$personal_urls, &$title ) {
 22+ static function addSourceTracking( &$personal_urls, &$title ) {
2923 global $wgRequest, $wgUser, $wgServer, $wgSecureLogin;
3024
3125 // Generate source tracking parameters
Index: trunk/extensions/SignupAPI/includes/SpecialUserSignup.php
@@ -128,6 +128,7 @@
129129 }
130130
131131 public function execute( $par ) {
 132+ global $wgOut;
132133
133134 if ( session_id() == '' ) {
134135 wfSetupSession();
@@ -137,6 +138,12 @@
138139 $this->mType = 'signup';
139140 }
140141
 142+ // Ajax-ify ?
 143+ if ( $wgSignupAPIUseAjax ) {
 144+ $wgOut->addModules( 'ext.SignupAPI' );
 145+ }
 146+
 147+
141148 if ( !is_null( $this->mCookieCheck ) ) {
142149 $this->onCookieRedirectCheck( $this->mCookieCheck );
143150 return;

Status & tagging log