Index: trunk/extensions/OpenID/OpenID.hooks.php |
— | — | @@ -174,19 +174,36 @@ |
175 | 175 | return true; |
176 | 176 | } |
177 | 177 | public static function onLoadExtensionSchemaUpdates() { |
178 | | - global $wgDBtype, $wgExtNewTables; |
| 178 | + global $wgDBtype, $wgUpdates, $wgExtNewTables; |
179 | 179 | |
180 | 180 | $base = dirname( __FILE__ ); |
181 | 181 | |
182 | 182 | if ( $wgDBtype == 'mysql' ) { |
183 | 183 | $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.sql" ); |
| 184 | + $wgUpdates['mysql'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) ); |
184 | 185 | } else if ( $wgDBtype == 'postgres' ) { |
185 | 186 | $wgExtNewTables[] = array( 'user_openid', "$base/openid_table.pg.sql" ); |
| 187 | + $wgUpdates['postgres'][] = array( array( __CLASS__, 'makeUoiUserNotUnique' ) ); |
186 | 188 | } |
187 | 189 | |
188 | 190 | return true; |
189 | 191 | } |
190 | 192 | |
| 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 | + |
191 | 208 | private static function loginStyle() { |
192 | 209 | global $wgOpenIDLoginLogoUrl; |
193 | 210 | return <<<EOS |