Index: trunk/phase3/maintenance/indexes.sql |
— | — | @@ -51,7 +51,8 @@ |
52 | 52 | ADD INDEX rc_timestamp (rc_timestamp), |
53 | 53 | ADD INDEX rc_namespace_title (rc_namespace, rc_title), |
54 | 54 | ADD INDEX rc_cur_id (rc_cur_id), |
55 | | - ADD INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp); |
| 55 | + ADD INDEX new_name_timestamp(rc_new,rc_namespace,rc_timestamp), |
| 56 | + ADD INDEX rc_ip (rc_ip); |
56 | 57 | |
57 | 58 | ALTER TABLE archive |
58 | 59 | ADD KEY `name_title_timestamp` (`ar_namespace`,`ar_title`,`ar_timestamp`); |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -134,6 +134,11 @@ |
135 | 135 | dbsource( "maintenance/archives/patch-rc_type.sql" , $wgDatabase ); |
136 | 136 | echo "ok\n"; |
137 | 137 | } |
| 138 | + if ( !$wgDatabase->fieldExists( "recentchanges", "rc_ip" ) ) { |
| 139 | + echo "Adding rc_ip..."; |
| 140 | + dbsource( "maintenance/archives/patch-rc_ip.sql", $wgDatabase ); |
| 141 | + echo "ok\n"; |
| 142 | + } |
138 | 143 | } |
139 | 144 | |
140 | 145 | function do_user_real_name_update() { |
— | — | @@ -179,5 +184,4 @@ |
180 | 185 | echo "ok\n"; |
181 | 186 | } |
182 | 187 | } |
183 | | - |
184 | | -?> |
\ No newline at end of file |
| 188 | +?> |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -189,7 +189,8 @@ |
190 | 190 | rc_last_oldid int(10) unsigned NOT NULL default '0', |
191 | 191 | rc_type tinyint(3) unsigned NOT NULL default '0', |
192 | 192 | rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0', |
193 | | - rc_moved_to_title varchar(255) binary NOT NULL default '' |
| 193 | + rc_moved_to_title varchar(255) binary NOT NULL default '', |
| 194 | + rc_ip char(15) NOT NULL default '' |
194 | 195 | ) PACK_KEYS=1; |
195 | 196 | |
196 | 197 | CREATE TABLE watchlist ( |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 | rc_this_oldid old_id associated with this entry (or zero) |
23 | 23 | rc_last_oldid old_id associated with the entry before this one (or zero) |
24 | 24 | rc_bot is bot, hidden |
| 25 | + rc_ip IP address of the user in dotted quad notation |
25 | 26 | rc_new obsolete, use rc_type==RC_NEW |
26 | 27 | |
27 | 28 | mExtra: |
— | — | @@ -82,7 +83,7 @@ |
83 | 84 | # Writes the data in this object to the database |
84 | 85 | function save() |
85 | 86 | { |
86 | | - global $wgUseRCQueue, $wgRCQueueID, $wgLocalInterwiki; |
| 87 | + global $wgUseRCQueue, $wgRCQueueID, $wgLocalInterwiki, $wgPutIPinRC; |
87 | 88 | $fname = "RecentChange::save"; |
88 | 89 | |
89 | 90 | if ( !is_array($this->mExtra) ) { |
— | — | @@ -90,6 +91,10 @@ |
91 | 92 | } |
92 | 93 | $this->mExtra['lang'] = $wgLocalInterwiki; |
93 | 94 | |
| 95 | + if ( !$wgPutIPinRC ) { |
| 96 | + $this->mAttribs['rc_ip'] = ''; |
| 97 | + } |
| 98 | + |
94 | 99 | # Insert new row |
95 | 100 | wfInsertArray( "recentchanges", $this->mAttribs, $fname ); |
96 | 101 | |
— | — | @@ -126,12 +131,17 @@ |
127 | 132 | |
128 | 133 | # Makes an entry in the database corresponding to an edit |
129 | 134 | /*static*/ function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, |
130 | | - $oldId, $lastTimestamp, $bot = "default" ) |
| 135 | + $oldId, $lastTimestamp, $bot = "default", $ip = '' ) |
131 | 136 | { |
132 | 137 | if ( $bot == "default " ) { |
133 | 138 | $bot = $user->isBot(); |
134 | 139 | } |
135 | 140 | |
| 141 | + if ( !$ip ) { |
| 142 | + global $wgIP; |
| 143 | + $ip = empty( $wgIP ) ? '' : $wgIP; |
| 144 | + } |
| 145 | + |
136 | 146 | $rc = new RecentChange; |
137 | 147 | $rc->mAttribs = array( |
138 | 148 | 'rc_timestamp' => $timestamp, |
— | — | @@ -149,6 +159,7 @@ |
150 | 160 | 'rc_bot' => $bot ? 1 : 0, |
151 | 161 | 'rc_moved_to_ns' => 0, |
152 | 162 | 'rc_moved_to_title' => '', |
| 163 | + 'rc_ip' => $ip, |
153 | 164 | 'rc_new' => 0 # obsolete |
154 | 165 | ); |
155 | 166 | |
— | — | @@ -161,28 +172,34 @@ |
162 | 173 | |
163 | 174 | # Makes an entry in the database corresponding to page creation |
164 | 175 | # Note: the title object must be loaded with the new id using resetArticleID() |
165 | | - /*static*/ function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default" ) |
| 176 | + /*static*/ function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default", $ip='' ) |
166 | 177 | { |
| 178 | + if ( !$ip ) { |
| 179 | + global $wgIP; |
| 180 | + $ip = empty( $wgIP ) ? '' : $wgIP; |
| 181 | + } |
167 | 182 | if ( $bot == "default" ) { |
168 | 183 | $bot = $user->isBot(); |
169 | 184 | } |
| 185 | + |
170 | 186 | $rc = new RecentChange; |
171 | 187 | $rc->mAttribs = array( |
172 | | - 'rc_timestamp' => $timestamp, |
173 | | - 'rc_cur_time' => $timestamp, |
174 | | - 'rc_namespace' => $title->getNamespace(), |
175 | | - 'rc_title' => $title->getDBkey(), |
176 | | - 'rc_type' => RC_NEW, |
177 | | - 'rc_minor' => $minor ? 1 : 0, |
178 | | - 'rc_cur_id' => $title->getArticleID(), |
179 | | - 'rc_user' => $user->getID(), |
180 | | - 'rc_user_text' => $user->getName(), |
181 | | - 'rc_comment' => $comment, |
182 | | - 'rc_this_oldid' => 0, |
183 | | - 'rc_last_oldid' => 0, |
184 | | - 'rc_bot' => $bot ? 1 : 0, |
185 | | - 'rc_moved_to_ns' => 0, |
186 | | - 'rc_moved_to_title' => '', |
| 188 | + 'rc_timestamp' => $timestamp, |
| 189 | + 'rc_cur_time' => $timestamp, |
| 190 | + 'rc_namespace' => $title->getNamespace(), |
| 191 | + 'rc_title' => $title->getDBkey(), |
| 192 | + 'rc_type' => RC_NEW, |
| 193 | + 'rc_minor' => $minor ? 1 : 0, |
| 194 | + 'rc_cur_id' => $title->getArticleID(), |
| 195 | + 'rc_user' => $user->getID(), |
| 196 | + 'rc_user_text' => $user->getName(), |
| 197 | + 'rc_comment' => $comment, |
| 198 | + 'rc_this_oldid' => 0, |
| 199 | + 'rc_last_oldid' => 0, |
| 200 | + 'rc_bot' => $bot ? 1 : 0, |
| 201 | + 'rc_moved_to_ns' => 0, |
| 202 | + 'rc_moved_to_title' => '', |
| 203 | + 'rc_ip' => $ip, |
187 | 204 | 'rc_new' => 1 # obsolete |
188 | 205 | ); |
189 | 206 | |
— | — | @@ -194,8 +211,12 @@ |
195 | 212 | } |
196 | 213 | |
197 | 214 | # Makes an entry in the database corresponding to a rename |
198 | | - /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment ) |
| 215 | + /*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='' ) |
199 | 216 | { |
| 217 | + if ( !$ip ) { |
| 218 | + global $wgIP; |
| 219 | + $ip = empty( $wgIP ) ? '' : $wgIP; |
| 220 | + } |
200 | 221 | $rc = new RecentChange; |
201 | 222 | $rc->mAttribs = array( |
202 | 223 | 'rc_timestamp' => $timestamp, |
— | — | @@ -213,6 +234,7 @@ |
214 | 235 | 'rc_bot' => $user->isBot() ? 1 : 0, |
215 | 236 | 'rc_moved_to_ns' => $newTitle->getNamespace(), |
216 | 237 | 'rc_moved_to_title' => $newTitle->getDBkey(), |
| 238 | + 'rc_ip' => $ip, |
217 | 239 | 'rc_new' => 0 # obsolete |
218 | 240 | ); |
219 | 241 | |
— | — | @@ -226,8 +248,12 @@ |
227 | 249 | |
228 | 250 | # A log entry is different to an edit in that previous revisions are |
229 | 251 | # not kept |
230 | | - /*static*/ function notifyLog( $timestamp, &$title, &$user, $comment ) |
| 252 | + /*static*/ function notifyLog( $timestamp, &$title, &$user, $comment, $ip='' ) |
231 | 253 | { |
| 254 | + if ( !$ip ) { |
| 255 | + global $wgIP; |
| 256 | + $ip = empty( $wgIP ) ? '' : $wgIP; |
| 257 | + } |
232 | 258 | $rc = new RecentChange; |
233 | 259 | $rc->mAttribs = array( |
234 | 260 | 'rc_timestamp' => $timestamp, |
— | — | @@ -245,6 +271,7 @@ |
246 | 272 | 'rc_bot' => 0, |
247 | 273 | 'rc_moved_to_ns' => 0, |
248 | 274 | 'rc_moved_to_title' => '', |
| 275 | + 'rc_ip' => $ip, |
249 | 276 | 'rc_new' => 0 # obsolete |
250 | 277 | ); |
251 | 278 | $rc->mExtra = array( |
— | — | @@ -280,6 +307,7 @@ |
281 | 308 | 'rc_bot' => 0, |
282 | 309 | 'rc_moved_to_ns' => 0, |
283 | 310 | 'rc_moved_to_title' => '', |
| 311 | + 'rc_ip' => '', |
284 | 312 | 'rc_new' => $row->cur_is_new # obsolete |
285 | 313 | ); |
286 | 314 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -332,6 +332,9 @@ |
333 | 333 | # Show seconds in Recent Changes |
334 | 334 | $wgRCSeconds = false; |
335 | 335 | |
| 336 | +# Log IP addresses in the recentchanges table |
| 337 | +$wgPutIPinRC = false; |
| 338 | + |
336 | 339 | # RDF metadata toggles |
337 | 340 | $wgEnableDublinCoreRdf = false; |
338 | 341 | $wgEnableCreativeCommonsRdf = false; |