Index: trunk/extensions/SocialProfile/UserProfile/user_profile.sql |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | -- |
5 | 5 | |
6 | 6 | CREATE TABLE /*$wgDBprefix*/user_profile ( |
7 | | - `up_user_id` int(5) NOT NULL default '0', |
| 7 | + `up_user_id` int(5) NOT NULL PRIMARY KEY default '0', |
8 | 8 | `up_location_city` varchar(255) default NULL, |
9 | 9 | `up_location_state` varchar(100) default NULL, |
10 | 10 | `up_location_country` varchar(255) default NULL, |
— | — | @@ -34,6 +34,5 @@ |
35 | 35 | `up_custom_4` text, |
36 | 36 | `up_custom_5` text, |
37 | 37 | `up_last_seen` datetime default NULL, |
38 | | - `up_type` int(5) NOT NULL default '1', |
39 | | - PRIMARY KEY (`up_user_id`) |
| 38 | + `up_type` int(5) NOT NULL default '1' |
40 | 39 | ) DEFAULT CHARSET=utf8; |
Index: trunk/extensions/SocialProfile/UserRelationship/user_relationship.sql |
— | — | @@ -3,24 +3,23 @@ |
4 | 4 | -- |
5 | 5 | |
6 | 6 | CREATE TABLE /*$wgDBprefix*/user_relationship ( |
7 | | - `r_id` int(11) NOT NULL auto_increment, |
| 7 | + `r_id` int(11) PRIMARY KEY auto_increment, |
8 | 8 | `r_user_id` int(5) unsigned NOT NULL default '0', |
9 | 9 | `r_user_name` varchar(255) NOT NULL default '', |
10 | 10 | `r_user_id_relation` int(5) unsigned NOT NULL default '0', |
11 | 11 | `r_user_name_relation` varchar(255) NOT NULL default '', |
12 | 12 | `r_type` int(2) default NULL, |
13 | | - `r_date` datetime default NULL, |
14 | | - PRIMARY KEY (`r_id`), |
15 | | - KEY `r_user_id` (`r_user_id`), |
16 | | - KEY `r_user_id_relation` (`r_user_id_relation`) |
17 | | -)DEFAULT CHARSET=utf8; |
| 13 | + `r_date` datetime default NULL |
| 14 | +) DEFAULT CHARSET=utf8; |
| 15 | +CREATE INDEX /*i*/r_user_id ON /*_*/user_relationship (`r_user_id`); |
| 16 | +CREATE INDEX /*i*/r_user_id_relation ON /*_*/user_relationship (`r_user_id_relation`); |
18 | 17 | |
19 | 18 | -- |
20 | 19 | -- Table structure for table `user_relationship_request` |
21 | 20 | -- |
22 | 21 | |
23 | 22 | CREATE TABLE /*$wgDBprefix*/user_relationship_request ( |
24 | | - `ur_id` int(11) NOT NULL auto_increment, |
| 23 | + `ur_id` int(11) PRIMARY KEY auto_increment, |
25 | 24 | `ur_user_id_from` int(5) unsigned NOT NULL default '0', |
26 | 25 | `ur_user_name_from` varchar(255) NOT NULL default '', |
27 | 26 | `ur_user_id_to` int(5) unsigned NOT NULL default '0', |
— | — | @@ -28,8 +27,7 @@ |
29 | 28 | `ur_status` int(2) default '0', |
30 | 29 | `ur_type` int(2) default NULL, |
31 | 30 | `ur_message` varchar(255) default NULL, |
32 | | - `ur_date` datetime default NULL, |
33 | | - PRIMARY KEY (`ur_id`), |
34 | | - KEY `ur_user_id_from` (`ur_user_id_from`), |
35 | | - KEY `ur_user_id_to` (`ur_user_id_to`) |
| 31 | + `ur_date` datetime default NULL |
36 | 32 | ) DEFAULT CHARSET=utf8; |
| 33 | +CREATE INDEX /*i*/ur_user_id_from ON /*_*/user_relationship_request (`ur_user_id_from`); |
| 34 | +CREATE INDEX /*I*/ur_user_id_to ON /*_*/user_relationship_request (`ur_user_id_to`); |
Index: trunk/extensions/SocialProfile/SocialProfile.php |
— | — | @@ -199,80 +199,36 @@ |
200 | 200 | # Schema changes |
201 | 201 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efSocialProfileSchemaUpdates'; |
202 | 202 | |
203 | | -function efSocialProfileSchemaUpdates( $updater = null ) { |
204 | | - $dir = dirname( __FILE__ ); |
| 203 | +function efSocialProfileDBUpdate( $updater, $label, $file ) { |
205 | 204 | if ( $updater === null ) { |
206 | | - global $wgExtNewTables, $wgDBtype; |
207 | | - if ( $wgDBtype == 'mysql' ) { |
208 | | - // Initial install tables |
209 | | - $wgExtNewTables[] = array( 'user_board', "$dir/UserBoard/user_board.sql" ); |
210 | | - $wgExtNewTables[] = array( 'user_profile', "$dir/UserProfile/user_profile.sql" ); |
211 | | - $wgExtNewTables[] = array( 'user_stats', "$dir/UserStats/user_stats.sql" ); |
212 | | - $wgExtNewTables[] = array( 'user_relationship', "$dir/UserRelationship/user_relationship.sql" ); |
213 | | - $wgExtNewTables[] = array( 'user_relationship_request', "$dir/UserRelationship/user_relationship.sql" ); |
214 | | - $wgExtNewTables[] = array( 'user_system_gift', "$dir/SystemGifts/systemgifts.sql" ); |
215 | | - $wgExtNewTables[] = array( 'system_gift', "$dir/SystemGifts/systemgifts.sql" ); |
216 | | - $wgExtNewTables[] = array( 'user_gift', "$dir/UserGifts/usergifts.sql" ); |
217 | | - $wgExtNewTables[] = array( 'gift', "$dir/UserGifts/usergifts.sql" ); |
218 | | - $wgExtNewTables[] = array( 'user_system_messages', "$dir/UserSystemMessages/user_system_messages.sql" ); |
219 | | - } elseif( $wgDBtype == 'postgres' ) { |
220 | | - $wgExtNewTables[] = array( 'user_board', "$dir/UserBoard/user_board.postgres.sql" ); |
221 | | - $wgExtNewTables[] = array( 'user_profile', "$dir/UserProfile/user_profile.postgres.sql" ); |
222 | | - $wgExtNewTables[] = array( 'user_stats', "$dir/UserStats/user_stats.postgres.sql" ); |
223 | | - $wgExtNewTables[] = array( 'user_relationship', "$dir/UserRelationship/user_relationship.postgres.sql" ); |
224 | | - $wgExtNewTables[] = array( 'user_relationship_request', "$dir/UserRelationship/user_relationship.postgres.sql" ); |
225 | | - $wgExtNewTables[] = array( 'user_system_gift', "$dir/SystemGifts/systemgifts.postgres.sql" ); |
226 | | - $wgExtNewTables[] = array( 'system_gift', "$dir/SystemGifts/systemgifts.postgres.sql" ); |
227 | | - $wgExtNewTables[] = array( 'user_gift', "$dir/UserGifts/usergifts.postgres.sql" ); |
228 | | - $wgExtNewTables[] = array( 'gift', "$dir/UserGifts/usergifts.postgres.sql" ); |
229 | | - $wgExtNewTables[] = array( 'user_system_messages', "$dir/UserSystemMessages/user_system_messages.postgres.sql" ); |
230 | | - } |
| 205 | + global $wgExtNewTables; |
| 206 | + |
| 207 | + $wgExtNewTables[] = array( $label, $file ); |
231 | 208 | } else { |
232 | | - if ( $updater->getDB()->getType() == 'mysql' ) { |
233 | | - // Initial install tables |
234 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_board', |
235 | | - "$dir/UserBoard/user_board.sql", true ) ); |
236 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_profile', |
237 | | - "$dir/UserProfile/user_profile.sql", true ) ); |
238 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_stats', |
239 | | - "$dir/UserStats/user_stats.sql", true ) ); |
240 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_relationship', |
241 | | - "$dir/UserRelationship/user_relationship.sql", true ) ); |
242 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_relationship_request', |
243 | | - "$dir/UserRelationship/user_relationship.sql", true ) ); |
244 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_system_gift', |
245 | | - "$dir/SystemGifts/systemgifts.sql", true ) ); |
246 | | - $updater->addExtensionUpdate( array( 'addTable', 'system_gift', |
247 | | - "$dir/SystemGifts/systemgifts.sql", true ) ); |
248 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_gift', |
249 | | - "$dir/UserGifts/usergifts.sql", true ) ); |
250 | | - $updater->addExtensionUpdate( array( 'addTable', 'gift', |
251 | | - "$dir/UserGifts/usergifts.sql", true ) ); |
252 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_system_messages', |
253 | | - "$dir/UserSystemMessages/user_system_messages.sql", true ) ); |
254 | | - } elseif ( $updater->getDB()->getType() == 'postgres' ) { |
255 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_board', |
256 | | - "$dir/UserBoard/user_board.postgres.sql", true ) ); |
257 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_profile', |
258 | | - "$dir/UserProfile/user_profile.postgres.sql", true ) ); |
259 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_stats', |
260 | | - "$dir/UserStats/user_stats.postgres.sql", true ) ); |
261 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_relationship', |
262 | | - "$dir/UserRelationship/user_relationship.postgres.sql", true ) ); |
263 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_relationship_request', |
264 | | - "$dir/UserRelationship/user_relationship.postgres.sql", true ) ); |
265 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_system_gift', |
266 | | - "$dir/SystemGifts/systemgifts.postgres.sql", true ) ); |
267 | | - $updater->addExtensionUpdate( array( 'addTable', 'system_gift', |
268 | | - "$dir/SystemGifts/systemgifts.postgres.sql", true ) ); |
269 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_gift', |
270 | | - "$dir/UserGifts/usergifts.postgres.sql", true ) ); |
271 | | - $updater->addExtensionUpdate( array( 'addTable', 'gift', |
272 | | - "$dir/UserGifts/usergifts.postgres.sql", true ) ); |
273 | | - $updater->addExtensionUpdate( array( 'addTable', 'user_system_messages', |
274 | | - "$dir/UserSystemMessages/user_system_messages.postgres.sql", true ) ); |
275 | | - } |
| 209 | + $updater->addExtensionUpdate( array( 'addTable', $label, $file, true ) ); |
276 | 210 | } |
| 211 | +} |
| 212 | + |
| 213 | +function efSocialProfileSchemaUpdates( $updater = null ) { |
| 214 | + $dir = dirname( __FILE__ ); |
| 215 | + $dbExt = ""; |
| 216 | + global $wgExtNewTables, $wgDBtype; |
| 217 | + |
| 218 | + if ( $wgDBtype == 'postgres' ) { |
| 219 | + $dbExt = '.postgres'; |
| 220 | + } |
| 221 | + |
| 222 | + efSocialProfileDBUpdate( $updater, 'user_board', "$dir/UserBoard/user_board$dbExt.sql" ); |
| 223 | + efSocialProfileDBUpdate( $updater, 'user_profile', "$dir/UserProfile/user_profile$dbExt.sql" ); |
| 224 | + efSocialProfileDBUpdate( $updater, 'user_stats', "$dir/UserStats/user_stats$dbExt.sql" ); |
| 225 | + efSocialProfileDBUpdate( $updater, 'user_relationship', "$dir/UserRelationship/user_relationship$dbExt.sql" ); |
| 226 | + efSocialProfileDBUpdate( $updater, 'user_relationship_request', "$dir/UserRelationship/user_relationship$dbExt.sql" ); |
| 227 | + efSocialProfileDBUpdate( $updater, 'user_system_gift', "$dir/SystemGifts/systemgifts$dbExt.sql" ); |
| 228 | + efSocialProfileDBUpdate( $updater, 'system_gift', "$dir/SystemGifts/systemgifts$dbExt.sql" ); |
| 229 | + efSocialProfileDBUpdate( $updater, 'user_gift', "$dir/UserGifts/usergifts$dbExt.sql" ); |
| 230 | + efSocialProfileDBUpdate( $updater, 'gift', "$dir/UserGifts/usergifts$dbExt.sql" ); |
| 231 | + efSocialProfileDBUpdate( $updater, 'user_system_messages', "$dir/UserSystemMessages/user_system_messages$dbExt.sql" ); |
| 232 | + |
277 | 233 | return true; |
278 | 234 | } |
279 | 235 | |
Index: trunk/extensions/SocialProfile/SystemGifts/systemgifts.sql |
— | — | @@ -1,24 +1,22 @@ |
2 | 2 | CREATE TABLE /*$wgDBprefix*/user_system_gift ( |
3 | | - `sg_id` int(11) NOT NULL auto_increment, |
| 3 | + `sg_id` int(11) NOT NULL PRIMARY KEY auto_increment, |
4 | 4 | `sg_gift_id` int(5) unsigned NOT NULL default '0', |
5 | 5 | `sg_user_id` int(11) unsigned NOT NULL default '0', |
6 | 6 | `sg_user_name` varchar(255) NOT NULL default '', |
7 | 7 | `sg_status` int(2) default '1', |
8 | | - `sg_date` datetime default NULL, |
9 | | - PRIMARY KEY (`sg_id`), |
10 | | - KEY `sg_user_id` (`sg_user_id`), |
11 | | - KEY `sg_gift_id` (`sg_gift_id`) |
| 8 | + `sg_date` datetime default NULL |
12 | 9 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 10 | +CREATE INDEX /*i*/sg_user_id ON /*_*/user_system_gift (`sg_user_id`); |
| 11 | +CREATE INDEX /*i*/sg_gift_id ON /*_*/user_system_gift (`sg_gift_id`); |
13 | 12 | |
14 | 13 | CREATE TABLE /*$wgDBprefix*/system_gift ( |
15 | | - `gift_id` int(11) NOT NULL auto_increment, |
| 14 | + `gift_id` int(11) NOT NULL PRIMARY KEY auto_increment, |
16 | 15 | `gift_name` varchar(255) NOT NULL default '', |
17 | 16 | `gift_description` text, |
18 | 17 | `gift_given_count` int(11) default '0', |
19 | 18 | `gift_category` int(11) default '0', |
20 | 19 | `gift_threshold` int(15) default '0', |
21 | | - `gift_createdate` datetime default NULL, |
22 | | - PRIMARY KEY (`gift_id`), |
23 | | - KEY `giftcategoryidx` (`gift_category`), |
24 | | - KEY `giftthresholdidx` (`gift_threshold`) |
25 | | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
\ No newline at end of file |
| 20 | + `gift_createdate` datetime default NULL |
| 21 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 22 | +CREATE INDEX /*i*/giftcategoryidx ON /*_*/system_gift (`gift_category`); |
| 23 | +CREATE INDEX /*i*/giftthresholdidx ON /*_*/system_gift (`gift_threshold`); |
Index: trunk/extensions/SocialProfile/SystemGifts/SystemGifts.php |
— | — | @@ -1,5 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
| 4 | +global $IP, $wgScriptPath, $wgAutoloadClasses, $wgAvailableRights, $wgGroupPermissions, |
| 5 | + $wgSpecialPages, $wgExtenstionMessagesFiles; |
| 6 | + |
4 | 7 | $wgAvailableRights[] = 'awardsmanage'; |
5 | 8 | $wgGroupPermissions['staff']['awardsmanage'] = true; |
6 | 9 | $wgGroupPermissions['sysop']['awardsmanage'] = true; |
Index: trunk/extensions/SocialProfile/UserBoard/UserBoardClass.php |
— | — | @@ -287,7 +287,6 @@ |
288 | 288 | WHERE {$user_sql} |
289 | 289 | ORDER BY ub_id DESC |
290 | 290 | {$limit_sql}"; |
291 | | - |
292 | 291 | $res = $dbr->query( $sql, __METHOD__ ); |
293 | 292 | $messages = array(); |
294 | 293 | foreach ( $res as $row ) { |
Index: trunk/extensions/SocialProfile/UserBoard/user_board.sql |
— | — | @@ -3,16 +3,15 @@ |
4 | 4 | -- |
5 | 5 | |
6 | 6 | CREATE TABLE /*$wgDBprefix*/user_board ( |
7 | | - `ub_id` int(11) NOT NULL auto_increment, |
| 7 | + `ub_id` int(11) PRIMARY KEY auto_increment, |
8 | 8 | `ub_user_id` int(11) NOT NULL default '0', |
9 | 9 | `ub_user_name` varchar(255) NOT NULL default '', |
10 | 10 | `ub_user_id_from` int(11) NOT NULL default '0', |
11 | 11 | `ub_user_name_from` varchar(255) NOT NULL default '', |
12 | 12 | `ub_message` text NOT NULL, |
13 | 13 | `ub_type` int(5) default '0', |
14 | | - `ub_date` datetime default NULL, |
15 | | - PRIMARY KEY (`ub_id`), |
16 | | - KEY `ub_user_id` (`ub_user_id`), |
17 | | - KEY `ub_user_id_from` (`ub_user_id_from`), |
18 | | - KEY `ub_type` (`ub_type`) |
| 14 | + `ub_date` datetime default NULL |
19 | 15 | ) DEFAULT CHARSET=utf8; |
| 16 | +CREATE INDEX /*i*/ub_user_id ON /*_*/user_board (ub_user_id), |
| 17 | +CREATE INDEX /*i*/ub_user_id_from ON /*_*/user_board (ub_user_id_from), |
| 18 | +CREATE INDEX /*i*/ub_type ON /*_*/user_board (ub_type) |
Index: trunk/extensions/SocialProfile/UserGifts/usergifts.sql |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | CREATE TABLE /*$wgDBprefix*/user_gift ( |
3 | | - `ug_id` int(11) NOT NULL auto_increment, |
| 3 | + `ug_id` int(11) PRIMARY KEY auto_increment, |
4 | 4 | `ug_gift_id` int(5) unsigned NOT NULL default '0', |
5 | 5 | `ug_user_id_to` int(5) unsigned NOT NULL default '0', |
6 | 6 | `ug_user_name_to` varchar(255) NOT NULL default '', |
— | — | @@ -8,20 +8,18 @@ |
9 | 9 | `ug_status` int(2) default '1', |
10 | 10 | `ug_type` int(2) default NULL, |
11 | 11 | `ug_message` varchar(255) default NULL, |
12 | | - `ug_date` datetime default NULL, |
13 | | - PRIMARY KEY (`ug_id`), |
14 | | - KEY `ug_user_id_from` (`ug_user_id_from`), |
15 | | - KEY `ug_user_id_to` (`ug_user_id_to`) |
| 12 | + `ug_date` datetime default NULL |
16 | 13 | ) ENGINE=InnoDB; |
| 14 | +CREATE INDEX /*i*/ug_user_id_from ON /*_*/user_gift (`ug_user_id_from`); |
| 15 | +CREATE INDEX /*i*/ug_user_id_to ON /*_*/user_gift (`ug_user_id_to`); |
17 | 16 | |
18 | 17 | CREATE TABLE /*$wgDBprefix*/gift ( |
19 | | - `gift_id` int(11) unsigned NOT NULL auto_increment, |
| 18 | + `gift_id` int(11) UNSIGNED PRIMARY KEY auto_increment, |
20 | 19 | `gift_access` int(5) NOT NULL default '0', |
21 | 20 | `gift_creator_user_id` int(11) NOT NULL default '0', |
22 | 21 | `gift_creator_user_name` varchar(255) NOT NULL default '', |
23 | 22 | `gift_name` varchar(255) NOT NULL default '', |
24 | 23 | `gift_description` text, |
25 | 24 | `gift_given_count` int(5) default '0', |
26 | | - `gift_createdate` datetime default NULL, |
27 | | - PRIMARY KEY (`gift_id`) |
| 25 | + `gift_createdate` datetime default NULL |
28 | 26 | ) ENGINE=InnoDB; |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserGifts/SpecialGiveGift.php |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | parent::__construct( 'GiveGift' ); |
11 | 11 | } |
12 | 12 | |
| 13 | + |
13 | 14 | /** |
14 | 15 | * Show the special page |
15 | 16 | * |
— | — | @@ -34,7 +35,10 @@ |
35 | 36 | $gift_id = $wgRequest->getVal( 'gift_id' ); |
36 | 37 | $out = ''; |
37 | 38 | |
38 | | - if ( $wgUser->getID() == $this->user_id_to ) { |
| 39 | + var_dump( $wgUser->getID() ); |
| 40 | + var_dump( $this->user_id_to ); |
| 41 | + |
| 42 | + if ( $wgUser->getID() === $this->user_id_to ) { |
39 | 43 | $wgOut->setPageTitle( wfMsg( 'g-error-title' ) ); |
40 | 44 | $out .= wfMsg( 'g-error-message-to-yourself' ); |
41 | 45 | $wgOut->addHTML( $out ); |
Index: trunk/extensions/SocialProfile/UserSystemMessages/user_system_messages.sql |
— | — | @@ -1,10 +1,9 @@ |
2 | 2 | CREATE TABLE /*$wgDBprefix*/user_system_messages ( |
3 | | - `um_id` int(11) NOT NULL auto_increment, |
| 3 | + `um_id` int(11) NOT NULL PRIMARY KEY auto_increment, |
4 | 4 | `um_user_id` int(11) NOT NULL default '0', |
5 | 5 | `um_user_name` varchar(255) NOT NULL default '', |
6 | 6 | `um_message` varchar(255) NOT NULL default '', |
7 | 7 | `um_type` int(5) default '0', |
8 | | - `um_date` datetime default NULL, |
9 | | - PRIMARY KEY (`um_id`), |
10 | | - KEY `up_user_id` (`um_user_id`) |
11 | | -) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
\ No newline at end of file |
| 8 | + `um_date` datetime default NULL |
| 9 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
| 10 | +CREATE INDEX /*i*/up_user_id ON /*_*/user_system_messages (`um_user_id`); |