Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.sql |
— | — | @@ -2,28 +2,37 @@ |
3 | 3 | -- Licence: GNU GPL v3+ |
4 | 4 | -- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
5 | 5 | |
| 6 | +-- Watchlist groups |
6 | 7 | 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 |
11 | 14 | ) /*$wgDBTableOptions*/; |
12 | 15 | |
13 | 16 | -- List of all changes made to properties. |
14 | 17 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/swl_changes ( |
15 | 18 | 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) |
22 | 25 | ) /*$wgDBTableOptions*/; |
23 | 26 | |
| 27 | +-- Links changes to watchlist groups. |
24 | 28 | 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, |
26 | 30 | cpg_change_id INT(10) unsigned NOT NULL, |
27 | 31 | 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) |
28 | 39 | ) /*$wgDBTableOptions*/; |
\ No newline at end of file |
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php |
— | — | @@ -21,6 +21,8 @@ |
22 | 22 | * |
23 | 23 | * @param SMWStore $store |
24 | 24 | * @param SMWSemanticData $data |
| 25 | + * |
| 26 | + * @return true |
25 | 27 | */ |
26 | 28 | public static function onDataChanged( SMWStore $store, SMWSemanticData $data ) { |
27 | 29 | $title = $data->getSubject()->getTitle(); |
— | — | @@ -35,7 +37,7 @@ |
36 | 38 | } |
37 | 39 | } |
38 | 40 | |
39 | | - |
| 41 | + return true; |
40 | 42 | } |
41 | 43 | |
42 | 44 | /** |
— | — | @@ -77,8 +79,20 @@ |
78 | 80 | |
79 | 81 | } |
80 | 82 | |
| 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 | + */ |
81 | 93 | public static function onGroupNotify( $group, SMWSemanticData $data ) { |
82 | 94 | self::notifyUsersForGroup( $group, $data ); |
| 95 | + |
| 96 | + return true; |
83 | 97 | } |
84 | 98 | |
85 | 99 | /** |
— | — | @@ -162,6 +176,12 @@ |
163 | 177 | dirname( __FILE__ ) . '/SemanticWatchlist.sql', |
164 | 178 | true |
165 | 179 | ) ); |
| 180 | + $updater->addExtensionUpdate( array( |
| 181 | + 'addTable', |
| 182 | + 'swl_users_per_group', |
| 183 | + dirname( __FILE__ ) . '/SemanticWatchlist.sql', |
| 184 | + true |
| 185 | + ) ); |
166 | 186 | } |
167 | 187 | |
168 | 188 | return true; |