r60241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60240‎ | r60241 | r60242 >
Date:16:07, 20 December 2009
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
* (bug 19348) patch-uoi_user-not-unique.sql is now automatically applied in maintenance/update.php
(Not tested with postgreSQL, but should work)
Modified paths:
  • /trunk/extensions/OpenID/OpenID.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/OpenID.hooks.php
@@ -174,19 +174,36 @@
175175 return true;
176176 }
177177 public static function onLoadExtensionSchemaUpdates() {
178 - global $wgDBtype, $wgExtNewTables;
 178+ global $wgDBtype, $wgUpdates, $wgExtNewTables;
179179
180180 $base = dirname( __FILE__ );
181181
182182 if ( $wgDBtype == 'mysql' ) {
183183 $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" );
 184+ $wgUpdates['mysql'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
184185 } else if ( $wgDBtype == 'postgres' ) {
185186 $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" );
 187+ $wgUpdates['postgres'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) );
186188 }
187189
188190 return true;
189191 }
190192
 193+ public static function makeUoiUserNotUnique() {
 194+ $db = wfGetDB( DB_MASTER );
 195+ if ( !$db->tableExists( 'user_openid' ) )
 196+ return;
 197+
 198+ $info = $db->fieldInfo( 'user_openid', 'uoi_user' );
 199+ if ( !$info->isMultipleKey() ) {
 200+ wfOut( "Making uoi_user filed not unique..." );
 201+ $db->sourceFile( dirname( __FILE__ ) . '/patch-uoi_user-not-unique.sql' );
 202+ wfOut( " done.\n" );
 203+ } else {
 204+ wfOut( "...uoi_user field is already not unique\n" );
 205+ }
 206+ }
 207+
191208 private static function loginStyle() {
192209 global $wgOpenIDLoginLogoUrl;
193210 return <<<EOS

Follow-up revisions

RevisionCommit summaryAuthorDate
r60242Fixes for r60241:...ialex16:16, 20 December 2009
r81026Per MarkAHershberger's comment on r60241: isMultipleKey() only exists in MySQLialex15:14, 26 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52285Added provider picker to OpenIDConvert page (bug 19344)....sergeychernyshev15:36, 22 June 2009

Comments

#Comment by MarkAHershberger (talk | contribs)   22:05, 10 January 2011

Since r77083 removed isMultipleKey() from non-MySQL Field interface, you need to fix this.

#Comment by IAlex (talk | contribs)   15:14, 26 January 2011

Done in r81026.

Status & tagging log