r87638 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87637‎ | r87638 | r87639 >
Date:15:18, 7 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some more db schema changes
Modified paths:
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.sql
@@ -2,28 +2,37 @@
33 -- Licence: GNU GPL v3+
44 -- Author: Jeroen De Dauw < jeroendedauw@gmail.com >
55
 6+-- Watchlist groups
67 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/swl_groups (
7 - group_id INT(10) unsigned NOT NULL auto_increment PRIMARY KEY,
8 - group_categories BLOB NOT NULL, -- No need to have this stuff relational, so keep it simple
9 - group_namespaces BLOB NOT NULL, -- No need to have this stuff relational, so keep it simple
10 - group_properties BLOB NOT NULL -- No need to have this stuff relational, so keep it simple
 8+ group_id SMALLINT unsigned NOT NULL auto_increment PRIMARY KEY,
 9+ -- No need to have this stuff relational, so keep it simple.
 10+ -- These fields keep the IDs (or names in case of the properties), | separated.
 11+ group_categories BLOB NOT NULL,
 12+ group_namespaces BLOB NOT NULL,
 13+ group_properties BLOB NOT NULL
1114 ) /*$wgDBTableOptions*/;
1215
1316 -- List of all changes made to properties.
1417 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/swl_changes (
1518 change_id INT(10) unsigned NOT NULL auto_increment PRIMARY KEY,
16 - change_user_id INT(10) unsigned NOT NULL,
17 - change_page_id INT(10) unsigned NOT NULL,
18 - change_property VARCHAR(255) NOT NULL,
19 - change_old_value BLOB NULL,
20 - change_new_value BLOB NULL,
21 - change_type INT(1) unsigned NOT NULL
 19+ change_group_id INT(10) unsigned NOT NULL, -- This does NOT refer to the swl_groups table, but rather "groups of changes"
 20+ change_user_name VARCHAR(255) NOT NULL, -- The person that made the modification (account name or ip)
 21+ change_page_id INT(10) unsigned NOT NULL, -- The id of the page the modification was on
 22+ change_property VARCHAR(255) NOT NULL, -- Name of the property of which a value was changed
 23+ change_old_value BLOB NULL, -- The old value of the property (null for an adittion)
 24+ change_new_value BLOB NULL -- The new value of the property (null for a deletion)
2225 ) /*$wgDBTableOptions*/;
2326
 27+-- Links changes to watchlist groups.
2428 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/swl_changes_per_group (
25 - cpg_group_id INT(10) unsigned NOT NULL,
 29+ cpg_group_id SMALLINT unsigned NOT NULL,
2630 cpg_change_id INT(10) unsigned NOT NULL,
2731 PRIMARY KEY (cpg_group_id,cpg_change_id)
 32+) /*$wgDBTableOptions*/;
 33+
 34+-- Links users to watchlist groups.
 35+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/swl_users_per_group (
 36+ upg_group_id SMALLINT unsigned NOT NULL,
 37+ upg_user_id INT(10) unsigned NOT NULL,
 38+ PRIMARY KEY (upg_group_id,upg_user_id)
2839 ) /*$wgDBTableOptions*/;
\ No newline at end of file
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php
@@ -21,6 +21,8 @@
2222 *
2323 * @param SMWStore $store
2424 * @param SMWSemanticData $data
 25+ *
 26+ * @return true
2527 */
2628 public static function onDataChanged( SMWStore $store, SMWSemanticData $data ) {
2729 $title = $data->getSubject()->getTitle();
@@ -35,7 +37,7 @@
3638 }
3739 }
3840
39 -
 41+ return true;
4042 }
4143
4244 /**
@@ -77,8 +79,20 @@
7880
7981 }
8082
 83+ /**
 84+ * Determines and returns if the specified watchlist group covers
 85+ * the provided page or not.
 86+ *
 87+ * @since 0.1
 88+ *
 89+ * @param $group
 90+ *
 91+ * @return boolean
 92+ */
8193 public static function onGroupNotify( $group, SMWSemanticData $data ) {
8294 self::notifyUsersForGroup( $group, $data );
 95+
 96+ return true;
8397 }
8498
8599 /**
@@ -162,6 +176,12 @@
163177 dirname( __FILE__ ) . '/SemanticWatchlist.sql',
164178 true
165179 ) );
 180+ $updater->addExtensionUpdate( array(
 181+ 'addTable',
 182+ 'swl_users_per_group',
 183+ dirname( __FILE__ ) . '/SemanticWatchlist.sql',
 184+ true
 185+ ) );
166186 }
167187
168188 return true;

Status & tagging log