Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -189,7 +189,6 @@ |
190 | 190 | */ |
191 | 191 | public static function getFlaggedRevText( $rev_id ) { |
192 | 192 | wfProfileIn( __METHOD__ ); |
193 | | - |
194 | 193 | $db = wfGetDB( DB_SLAVE ); |
195 | 194 | // Get the text from the flagged revisions table |
196 | 195 | $result = $db->select( |
— | — | @@ -201,6 +200,8 @@ |
202 | 201 | if( $row = $db->fetchObject($result) ) { |
203 | 202 | return $row->fr_text; |
204 | 203 | } |
| 204 | + wfProfileOut( __METHOD__ ); |
| 205 | + |
205 | 206 | return NULL; |
206 | 207 | } |
207 | 208 | |
— | — | @@ -211,7 +212,6 @@ |
212 | 213 | */ |
213 | 214 | public static function getFlaggedRev( $rev_id ) { |
214 | 215 | wfProfileIn( __METHOD__ ); |
215 | | - |
216 | 216 | $db = wfGetDB( DB_SLAVE ); |
217 | 217 | // Skip deleted revisions |
218 | 218 | $result = $db->select( |
— | — | @@ -223,6 +223,8 @@ |
224 | 224 | if( $row = $db->fetchObject($result) ) { |
225 | 225 | return $row; |
226 | 226 | } |
| 227 | + wfProfileOut( __METHOD__ ); |
| 228 | + |
227 | 229 | return NULL; |
228 | 230 | } |
229 | 231 | |
— | — | @@ -232,10 +234,10 @@ |
233 | 235 | * Will include deleted revs here |
234 | 236 | */ |
235 | 237 | public static function getReviewedRevs( $page ) { |
236 | | - wfProfileIn( __METHOD__ ); |
237 | | - |
| 238 | + $rows = array(); |
| 239 | + |
| 240 | + wfProfileIn( __METHOD__ ); |
238 | 241 | $db = wfGetDB( DB_SLAVE ); |
239 | | - $rows = array(); |
240 | 242 | |
241 | 243 | $result = $db->select( |
242 | 244 | array('flaggedrevs'), |
— | — | @@ -246,6 +248,8 @@ |
247 | 249 | while ( $row = $db->fetchObject($result) ) { |
248 | 250 | $rows[$row->fr_rev_id] = $row->fr_quality; |
249 | 251 | } |
| 252 | + wfProfileOut( __METHOD__ ); |
| 253 | + |
250 | 254 | return $rows; |
251 | 255 | } |
252 | 256 | |
— | — | @@ -256,11 +260,11 @@ |
257 | 261 | */ |
258 | 262 | public static function getRevCountSince( $page_id, $from_rev ) { |
259 | 263 | wfProfileIn( __METHOD__ ); |
260 | | - |
261 | 264 | $db = wfGetDB( DB_SLAVE ); |
262 | 265 | $count = $db->selectField('revision', 'COUNT(*)', |
263 | 266 | array('rev_page' => $page_id, "rev_id > $from_rev"), |
264 | 267 | __METHOD__ ); |
| 268 | + wfProfileOut( __METHOD__ ); |
265 | 269 | |
266 | 270 | return $count; |
267 | 271 | } |
— | — | @@ -301,12 +305,13 @@ |
302 | 306 | public static function getFlagsForPageRev( $rev_id ) { |
303 | 307 | global $wgFlaggedRevTags; |
304 | 308 | |
305 | | - wfProfileIn( __METHOD__ ); |
306 | 309 | // Set all flags to zero |
307 | 310 | $flags = array(); |
308 | 311 | foreach( array_keys($wgFlaggedRevTags) as $tag ) { |
309 | 312 | $flags[$tag] = 0; |
310 | 313 | } |
| 314 | + |
| 315 | + wfProfileIn( __METHOD__ ); |
311 | 316 | $db = wfGetDB( DB_SLAVE ); |
312 | 317 | // Grab all the tags for this revision |
313 | 318 | $result = $db->select( |
— | — | @@ -318,6 +323,7 @@ |
319 | 324 | while ( $row = $db->fetchObject($result) ) { |
320 | 325 | $flags[$row->frt_dimension] = $row->frt_value; |
321 | 326 | } |
| 327 | + wfProfileOut( __METHOD__ ); |
322 | 328 | |
323 | 329 | return $flags; |
324 | 330 | } |
— | — | @@ -1141,14 +1147,14 @@ |
1142 | 1148 | function getLatestQualityRev( $article=NULL ) { |
1143 | 1149 | global $wgArticle; |
1144 | 1150 | |
1145 | | - wfProfileIn( __METHOD__ ); |
1146 | | - |
1147 | 1151 | $article = $article ? $article : $wgArticle; |
1148 | 1152 | $title = $article->getTitle(); |
1149 | 1153 | // Cached results available? |
1150 | 1154 | if( isset($this->stablefound) ) { |
1151 | 1155 | return ( $this->stablefound ) ? $this->stablerev : null; |
1152 | 1156 | } |
| 1157 | + |
| 1158 | + wfProfileIn( __METHOD__ ); |
1153 | 1159 | $dbr = wfGetDB( DB_SLAVE ); |
1154 | 1160 | // Skip deleted revisions |
1155 | 1161 | $result = $dbr->select( |
— | — | @@ -1158,6 +1164,7 @@ |
1159 | 1165 | 'fr_rev_id = rev_id', 'rev_page' => $article->getId(), 'rev_deleted = 0'), |
1160 | 1166 | __METHOD__, |
1161 | 1167 | array('ORDER BY' => 'fr_rev_id DESC', 'LIMIT' => 1 ) ); |
| 1168 | + wfProfileOut( __METHOD__ ); |
1162 | 1169 | // Do we have one? |
1163 | 1170 | if( $row = $dbr->fetchObject($result) ) { |
1164 | 1171 | $this->stablefound = true; |
— | — | @@ -1182,14 +1189,13 @@ |
1183 | 1190 | function getLatestStableRev( $article=NULL ) { |
1184 | 1191 | global $wgArticle; |
1185 | 1192 | |
1186 | | - wfProfileIn( __METHOD__ ); |
1187 | | - |
1188 | 1193 | $article = $article ? $article : $wgArticle; |
1189 | 1194 | $title = $article->getTitle(); |
1190 | 1195 | // Cached results available? |
1191 | 1196 | if( isset($this->latestfound) ) { |
1192 | 1197 | return ( $this->latestfound ) ? $this->latestrev : NULL; |
1193 | 1198 | } |
| 1199 | + wfProfileIn( __METHOD__ ); |
1194 | 1200 | $dbr = wfGetDB( DB_SLAVE ); |
1195 | 1201 | // Skip deleted revisions |
1196 | 1202 | $result = $dbr->select( |
— | — | @@ -1199,6 +1205,7 @@ |
1200 | 1206 | 'fr_rev_id = rev_id', 'rev_page' => $article->getId(), 'rev_deleted = 0'), |
1201 | 1207 | __METHOD__, |
1202 | 1208 | array('ORDER BY' => 'fr_rev_id DESC', 'LIMIT' => 1 ) ); |
| 1209 | + wfProfileOut( __METHOD__ ); |
1203 | 1210 | // Do we have one? |
1204 | 1211 | if( $row = $dbr->fetchObject($result) ) { |
1205 | 1212 | $this->latestfound = true; |
— | — | @@ -1217,7 +1224,6 @@ |
1218 | 1225 | public function getFlagsForRevision( $rev_id ) { |
1219 | 1226 | global $wgFlaggedRevTags; |
1220 | 1227 | |
1221 | | - wfProfileIn( __METHOD__ ); |
1222 | 1228 | // Cached results? |
1223 | 1229 | if( isset($this->flags[$rev_id]) && $this->flags[$rev_id] ) |
1224 | 1230 | return $this->revflags[$rev_id]; |
— | — | @@ -1226,6 +1232,8 @@ |
1227 | 1233 | foreach( array_keys($wgFlaggedRevTags) as $tag ) { |
1228 | 1234 | $flags[$tag] = 0; |
1229 | 1235 | } |
| 1236 | + |
| 1237 | + wfProfileIn( __METHOD__ ); |
1230 | 1238 | $db = wfGetDB( DB_SLAVE ); |
1231 | 1239 | // Grab all the tags for this revision |
1232 | 1240 | $result = $db->select( |
— | — | @@ -1233,6 +1241,8 @@ |
1234 | 1242 | array('frt_dimension', 'frt_value'), |
1235 | 1243 | array('frt_rev_id' => $rev_id), |
1236 | 1244 | __METHOD__ ); |
| 1245 | + wfProfileOut( __METHOD__ ); |
| 1246 | + |
1237 | 1247 | // Iterate through each tag result |
1238 | 1248 | while( $row = $db->fetchObject($result) ) { |
1239 | 1249 | $flags[$row->frt_dimension] = $row->frt_value; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php |
— | — | @@ -272,8 +272,6 @@ |
273 | 273 | function approveRevision( $rev=NULL, $notes='' ) { |
274 | 274 | global $wgUser, $wgFlaggedRevsWatch, $wgParser; |
275 | 275 | |
276 | | - wfProfileIn( __METHOD__ ); |
277 | | - |
278 | 276 | if( is_null($rev) ) return false; |
279 | 277 | // No bogus timestamps |
280 | 278 | if ( $this->timestamp && ($this->timestamp < $rev->getTimestamp() || $this->timestamp > wfTimestampNow()) ) |
— | — | @@ -344,6 +342,7 @@ |
345 | 343 | ); |
346 | 344 | } |
347 | 345 | |
| 346 | + wfProfileIn( __METHOD__ ); |
348 | 347 | $dbw = wfGetDB( DB_MASTER ); |
349 | 348 | // Update our versioning pointers |
350 | 349 | if( !empty( $tmpset ) ) { |
— | — | @@ -392,6 +391,8 @@ |
393 | 392 | # Purge squid for this page only |
394 | 393 | $this->page->purgeSquid(); |
395 | 394 | |
| 395 | + wfProfileOut( __METHOD__ ); |
| 396 | + |
396 | 397 | return true; |
397 | 398 | } |
398 | 399 | |
— | — | @@ -401,13 +402,12 @@ |
402 | 403 | */ |
403 | 404 | function unapproveRevision( $row=NULL ) { |
404 | 405 | global $wgUser, $wgFlaggedRevsWatch; |
405 | | - |
406 | | - wfProfileIn( __METHOD__ ); |
407 | 406 | |
408 | 407 | if( is_null($row) ) return false; |
409 | 408 | |
410 | 409 | $user = $wgUser->getId(); |
411 | 410 | |
| 411 | + wfProfileIn( __METHOD__ ); |
412 | 412 | $dbw = wfGetDB( DB_MASTER ); |
413 | 413 | // Delete from table |
414 | 414 | $dbw->delete( 'flaggedrevs', array( 'fr_rev_id' => $row->fr_rev_id ) ); |
— | — | @@ -439,6 +439,8 @@ |
440 | 440 | # Purge squid for this page only |
441 | 441 | $this->page->purgeSquid(); |
442 | 442 | |
| 443 | + wfProfileOut( __METHOD__ ); |
| 444 | + |
443 | 445 | return true; |
444 | 446 | } |
445 | 447 | |