Index: trunk/extensions/MoodBar/sql/MoodBar.sql |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | -- User who provided the feedback |
7 | 7 | mbf_user_id int unsigned NOT NULL, -- User ID, or zero |
8 | 8 | mbf_user_ip varchar(255) binary NULL, -- If anonymous, user's IP address |
| 9 | + mbf_user_editcount int unsigned NOT NULL, -- Edit count of the user |
9 | 10 | |
10 | 11 | -- Page where the feedback was received |
11 | 12 | -- Nullable. |
Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | 'moodbar-header-locale' => 'Locale', |
48 | 48 | 'moodbar-header-useragent' => 'User-Agent', |
49 | 49 | 'moodbar-header-comment' => 'Comments', |
| 50 | + 'moodbar-header-user-editcount' => 'User edit count', |
50 | 51 | ); |
51 | 52 | |
52 | 53 | /** Message documentation (Message documentation) |
Index: trunk/extensions/MoodBar/FeedbackItem.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | 'locale', |
27 | 27 | 'editmode', |
28 | 28 | 'bucket', |
| 29 | + 'user-editcount', |
29 | 30 | ); |
30 | 31 | |
31 | 32 | /** Valid values for the 'type' parameter. **/ |
— | — | @@ -100,6 +101,7 @@ |
101 | 102 | 'locale' => $row->mbf_locale, |
102 | 103 | 'bucket' => $row->mbf_bucket, |
103 | 104 | 'editmode' => $row->mbf_editing, |
| 105 | + 'user-editcount' => $row->mbf_user_editcount, |
104 | 106 | ); |
105 | 107 | |
106 | 108 | $properties['page'] = Title::makeTitleSafe( $row->mbf_namespace, $row->mbf_title ); |
— | — | @@ -127,6 +129,14 @@ |
128 | 130 | throw new MWException( "Attempt to set invalid value for $key" ); |
129 | 131 | } |
130 | 132 | |
| 133 | + if ( $key == 'user' ) { |
| 134 | + if ( $user->isAnon() ) { |
| 135 | + $this->setProperty( 'user-editcount', 0 ); |
| 136 | + } else { |
| 137 | + $this->setProperty( 'user-editcount', $user->edits() ); |
| 138 | + } |
| 139 | + } |
| 140 | + |
131 | 141 | $this->data[$key] = $value; |
132 | 142 | } |
133 | 143 | } |
— | — | @@ -204,6 +214,7 @@ |
205 | 215 | 'mbf_locale' => $this->getProperty('locale'), |
206 | 216 | 'mbf_bucket' => $this->getProperty('bucket'), |
207 | 217 | 'mbf_editing' => $this->getProperty('editmode'), |
| 218 | + 'mbf_user_editcount' => $this->getProperty('user-editcount'), |
208 | 219 | ); |
209 | 220 | |
210 | 221 | $user = $this->getProperty('user'); |
Index: trunk/extensions/MoodBar/SpecialMoodBar.php |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | 'page', |
10 | 10 | 'usertype', |
11 | 11 | 'user', |
| 12 | + 'user-editcount', |
12 | 13 | 'editmode', |
13 | 14 | 'bucket', |
14 | 15 | 'system', |
Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -50,6 +50,10 @@ |
51 | 51 | $updater->addExtensionUpdate( array( 'addTable', 'moodbar_feedback', |
52 | 52 | dirname(__FILE__).'/sql/MoodBar.sql', true ) ); |
53 | 53 | |
| 54 | + $updater->addExtensionUpdate( array( 'addField', 'moodbar_feedback', |
| 55 | + 'mbf_user_editcount', dirname(__FILE__).'/sql/mbf_user_editcount.sql', true ) |
| 56 | + ); |
| 57 | + |
54 | 58 | return true; |
55 | 59 | } |
56 | 60 | } |