Index: trunk/extensions/OpenID/README.OpenID-mediawiki-extension |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | MediaWiki OpenID extension README.OpenID-mediawiki-extension file |
3 | | -version 0.939-beta 20110922 |
| 3 | +version 0.940-beta 20111011 |
4 | 4 | |
5 | 5 | Homepage and manual http://www.mediawiki.org/wiki/Extension:OpenID |
6 | 6 | |
— | — | @@ -467,6 +467,7 @@ |
468 | 468 | into that account now |
469 | 469 | |
470 | 470 | == CHANGES == |
| 471 | +* 0.940 changed database schema updater; tested for MySQL |
471 | 472 | * 0.939 function name changes |
472 | 473 | * 0.938 list uoi_user_registration timestamp if present in openid-preference tab |
473 | 474 | * 0.937 added uoi_user_registration timestamp field (bug30623) |
Index: trunk/extensions/OpenID/OpenID.hooks.php |
— | — | @@ -323,66 +323,55 @@ |
324 | 324 | } |
325 | 325 | |
326 | 326 | public static function onLoadExtensionSchemaUpdates( $updater = null ) { |
327 | | - $base = dirname( __FILE__ ) . '/patches'; |
328 | | - if ( $updater === null ) { // < 1.17 |
329 | | - global $wgDBtype, $wgUpdates, $wgExtNewTables; |
330 | | - if ( $wgDBtype == 'mysql' ) { |
331 | | - $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" ); |
332 | | - $wgUpdates['mysql'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) ); |
333 | | - $wgUpdates['mysql'][] = array( array( __CLASS__, 'addUoiUserRegistration' ) ); |
334 | | - } elseif ( $wgDBtype == 'postgres' ) { |
335 | | - $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" ); |
336 | | - # This doesn't work since MediaWiki doesn't use $wgUpdates when |
337 | | - # updating a PostgreSQL database |
338 | | - # $wgUpdates['postgres'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) ); |
339 | | - } |
340 | | - } else { |
341 | | - $dbPatch = "$base/" . ( $updater->getDB()->getType() == 'postgres' ? |
342 | | - 'openid_table.pg.sql' : 'openid_table.sql' ); |
343 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_openid', $dbPatch, true ) ); |
344 | | - if ( $updater->getDB()->getType() == 'mysql' ) { |
345 | | - $updater->addExtensionUpdate( array( array( __CLASS__, 'makeUoiUserNotUnique' ) ) ); |
346 | | - $updater->addExtensionUpdate( array( array( __CLASS__, 'addUoiUserRegistration' ) ) ); |
347 | | - } |
348 | | - } |
349 | | - |
350 | | - return true; |
351 | | - } |
352 | | - |
353 | | - public static function makeUoiUserNotUnique( $updater = null ) { |
354 | 327 | if ( $updater === null ) { |
355 | | - $db = wfGetDB( DB_MASTER ); |
356 | | - } else { |
357 | | - $db = $updater->getDB(); |
358 | | - } |
359 | | - if ( !$db->tableExists( 'user_openid' ) ) |
360 | | - return; |
| 328 | + // <= 1.16 support - but OpenID does not work with such old MW versions |
| 329 | + global $wgExtNewTables, $wgExtNewFields; |
| 330 | + $wgExtNewTables[] = array( |
| 331 | + 'user_openid', |
| 332 | + dirname( __FILE__ ) . '/patches/openid_table.sql' |
| 333 | + ); |
361 | 334 | |
362 | | - $info = $db->fieldInfo( 'user_openid', 'uoi_user' ); |
363 | | - if ( !$info->isMultipleKey() ) { |
364 | | - echo( "Making uoi_user field not unique..." ); |
365 | | - $db->sourceFile( dirname( __FILE__ ) . '/patches/patch-uoi_user-not-unique.sql' ); |
366 | | - echo( " done.\n" ); |
367 | | - } else { |
368 | | - echo( "...uoi_user field is already not unique.\n" ); |
369 | | - } |
370 | | - } |
371 | | - public static function addUoiUserRegistration( $updater = null ) { |
372 | | - if ( $updater === null ) { |
| 335 | + # if index of older OpenID version is unique then upgrade and make index non unique |
373 | 336 | $db = wfGetDB( DB_MASTER ); |
| 337 | + $info = $db->fieldInfo( 'user_openid', 'uoi_user' ); |
| 338 | + if ( !$info->isMultipleKey() ) { |
| 339 | + echo( "Making uoi_user field non UNIQUE...\n" ); |
| 340 | + $db->sourceFile( dirname( __FILE__ ) . '/patches/patch-uoi_user-not-unique.sql' ); |
| 341 | + echo( " done.\n" ); |
| 342 | + } else { |
| 343 | + echo( "...uoi_user field is already non UNIQUE.\n" ); |
| 344 | + } |
| 345 | + |
| 346 | + # uoi_user_registration field was added in OpenID version 0.937 |
| 347 | + $wgExtNewFields[] = array( |
| 348 | + 'user_openid', |
| 349 | + 'uoi_user_registration', |
| 350 | + dirname( __FILE__ ) . '/patches/patch-add_uoi_user_registration.sql' |
| 351 | + ); |
374 | 352 | } else { |
| 353 | + // >= 1.17 support |
| 354 | + $updater->addExtensionUpdate( array( 'addTable', 'user_openid', |
| 355 | + dirname( __FILE__ ) . '/patches/openid_table.sql', true ) ); |
| 356 | + |
| 357 | + # if index of older OpenID version is unique then upgrade and make index non unique |
375 | 358 | $db = $updater->getDB(); |
| 359 | + $info = $db->fieldInfo( 'user_openid', 'uoi_user' ); |
| 360 | + if ( !$info->isMultipleKey() ) { |
| 361 | + echo( "Making uoi_user field non UNIQUE...\n" ); |
| 362 | + $updater->dropIndex( 'user_openid', 'uoi_user', |
| 363 | + dirname( __FILE__ ) . '/patches/patch-drop_non_multiple_key_index_uoi_user.sql', true ); |
| 364 | + $updater->addIndex( 'user_openid', 'user_openid_user', |
| 365 | + dirname( __FILE__ ) . '/patches/patch-add_multiple_key_index_user_openid_user.sql', true ); |
| 366 | + echo( "...done.\n" ); |
| 367 | + } else { |
| 368 | + echo( "...uoi_user field is already non UNIQUE.\n" ); |
| 369 | + } |
| 370 | + |
| 371 | + # uoi_user_registration field was added in OpenID version 0.937 |
| 372 | + $updater->addExtensionUpdate( array( 'addField', 'user_openid', 'uoi_user_registration', |
| 373 | + dirname( __FILE__ ) . '/patches/patch-add_uoi_user_registration.sql', true ) ); |
376 | 374 | } |
377 | | - if ( !$db->tableExists( 'user_openid' ) ) |
378 | | - return; |
379 | | - |
380 | | - if ( !$db->fieldExists( 'user_openid', 'uoi_user_registration' ) ) { |
381 | | - echo( "Adding uoi_user_registration field..." ); |
382 | | - $db->sourceFile( dirname( __FILE__ ) . '/patches/patch-uoi_user_registration-not-present.sql' ); |
383 | | - echo( " done.\n" ); |
384 | | - } else { |
385 | | - echo( "...uoi_user_registration field present.\n" ); |
386 | | - } |
| 375 | + return true; |
387 | 376 | } |
388 | 377 | |
389 | 378 | private static function loginStyle() { |
Index: trunk/extensions/OpenID/patches/patch-uoi_user_registration-not-present.sql |
— | — | @@ -1,4 +0,0 @@ |
2 | | -ALTER TABLE /*_*/user_openid ADD uoi_user_registration BINARY(14); |
Index: trunk/extensions/OpenID/patches/patch-add_multiple_key_index_user_openid_user.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- |
| 3 | +-- SQL schema update for OpenID extension to add a non unique uoi_user index |
| 4 | +-- |
| 5 | + |
| 6 | +CREATE INDEX /*i*/user_openid_user ON /*_*/user_openid(uoi_user); |
Property changes on: trunk/extensions/OpenID/patches/patch-add_multiple_key_index_user_openid_user.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/OpenID/patches/patch-add_uoi_user_registration.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- |
| 3 | +-- SQL schema update for OpenID extension to add the uoi_user_registration field |
| 4 | +-- |
| 5 | +ALTER TABLE /*_*/user_openid ADD uoi_user_registration BINARY(14); |
Property changes on: trunk/extensions/OpenID/patches/patch-add_uoi_user_registration.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/extensions/OpenID/patches/patch-drop_non_multiple_key_index_uoi_user.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- |
| 3 | +-- SQL schema update for OpenID extension to drop uoi_user field because it is unique |
| 4 | +-- |
| 5 | + |
| 6 | +ALTER TABLE /*_*/user_openid DROP INDEX uoi_user; |
Property changes on: trunk/extensions/OpenID/patches/patch-drop_non_multiple_key_index_uoi_user.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/OpenID/OpenID.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | exit( 1 ); |
29 | 29 | } |
30 | 30 | |
31 | | -define( 'MEDIAWIKI_OPENID_VERSION', '0.939-beta 20110922' ); |
| 31 | +define( 'MEDIAWIKI_OPENID_VERSION', '0.940-beta 20111011' ); |
32 | 32 | |
33 | 33 | $path = dirname( __FILE__ ); |
34 | 34 | set_include_path( implode( PATH_SEPARATOR, array( $path ) ) . PATH_SEPARATOR . get_include_path() ); |