Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | array('fr_namespace' => $page->getNamespace(), 'fr_title' => $page->getDBkey() ), |
247 | 247 | __METHOD__ , |
248 | 248 | array('ORDER BY' => 'fr_rev_id DESC') ); |
249 | | - while ( $row = $db->fetchObject($result) ) { |
| 249 | + while( $row = $db->fetchObject($result) ) { |
250 | 250 | $rows[$row->fr_rev_id] = $row->fr_quality; |
251 | 251 | } |
252 | 252 | wfProfileOut( __METHOD__ ); |
— | — | @@ -667,6 +667,30 @@ |
668 | 668 | |
669 | 669 | $ig->isStable = true; |
670 | 670 | } |
| 671 | + |
| 672 | + static function parserInjectImageTimestamps( &$parser, &$text ) { |
| 673 | + $images = array(); |
| 674 | + $parser->mOutput->mImageTimestamps = array(); |
| 675 | + # Fetch the timestamps of the images |
| 676 | + if( !empty($parser->mOutput->mImages) ) { |
| 677 | + $dbr = wfGetDB( DB_SLAVE ); |
| 678 | + foreach( $parser->mOutput->mImages as $name => $v ) { |
| 679 | + $safename = $dbr->strencode( $name ); |
| 680 | + $images[] = "'$safename'"; |
| 681 | + } |
| 682 | + $res = $dbr->select('image', array('img_name','img_timestamp'), |
| 683 | + array('img_name IN(' . implode(',',$images) . ')'), |
| 684 | + __METHOD__ ); |
| 685 | + |
| 686 | + while( $row = $dbr->fetchObject($res) ) { |
| 687 | + $parser->mOutput->mImageTimestamps[$row->img_name] = $row->img_timestamp; |
| 688 | + } |
| 689 | + } |
| 690 | + } |
| 691 | + |
| 692 | + static function outputInjectImageTimestamps( &$out, &$parserOutput ) { |
| 693 | + $out->mImageTimestamps = $parserOutput->mImageTimestamps; |
| 694 | + } |
671 | 695 | |
672 | 696 | /** |
673 | 697 | * Callback that autopromotes user according to the setting in |
— | — | @@ -1285,4 +1309,7 @@ |
1286 | 1310 | $wgHooks['BeforeGalleryFindFile'][] = array( $flaggedrevs, 'galleryFindStableFileTime'); |
1287 | 1311 | $wgHooks['BeforeParserFetchTemplateAndtitle'][] = array( $flaggedrevs, 'parserFetchStableTemplate'); |
1288 | 1312 | $wgHooks['BeforeParserMakeImageLinkObj'][] = array( $flaggedrevs, 'parserMakeStableImageLink'); |
| 1313 | +// Additional parser versioning |
| 1314 | +$wgHooks['ParserAfterTidy'][] = array( $flaggedrevs, 'parserInjectImageTimestamps'); |
| 1315 | +$wgHooks['OutputPageParserOutput'][] = array( $flaggedrevs, 'outputInjectImageTimestamps'); |
1289 | 1316 | ?> |