Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -626,6 +626,24 @@ |
627 | 627 | $skip = true; |
628 | 628 | } |
629 | 629 | } |
| 630 | + |
| 631 | + static function galleryFindStableFileTime( &$ig, &$nt, &$time ) { |
| 632 | + // Trigger for stable version parsing only |
| 633 | + if( !isset($ig->isStable) || !$ig->isStable ) return; |
| 634 | + |
| 635 | + $dbr = wfGetDB( DB_SLAVE ); |
| 636 | + $time = $dbr->selectField('flaggedimages', 'fi_img_timestamp', |
| 637 | + array('fi_rev_id' => $ig->mRevisionId, 'fi_name' => $nt->getDBkey() ), |
| 638 | + __METHOD__ ); |
| 639 | + $time = $time ? $time : -1; // hack, will never find this |
| 640 | + } |
| 641 | + |
| 642 | + static function parserMakeGalleryStable( &$parser, &$ig ) { |
| 643 | + // Trigger for stable version parsing only |
| 644 | + if( !isset($parser->isStable) || !$parser->isStable ) return; |
| 645 | + |
| 646 | + $ig->isStable = true; |
| 647 | + } |
630 | 648 | |
631 | 649 | /** |
632 | 650 | * Callback that autopromotes user according to the setting in |
— | — | @@ -1164,6 +1182,8 @@ |
1165 | 1183 | // Update our table NS/Titles when things are moved |
1166 | 1184 | $wgHooks['SpecialMovepageAfterMove'][] = array($flaggedrevs, 'updateFromMove'); |
1167 | 1185 | // Parser hooks, selects the desired images/templates |
| 1186 | +$wgHooks['parserBeforerenderImageGallery'][] = array( $flaggedrevs, 'parserMakeGalleryStable'); |
| 1187 | +$wgHooks['BeforeGalleryFindFile'][] = array( $flaggedrevs, 'galleryFindStableFileTime'); |
1168 | 1188 | $wgHooks['BeforeParserFetchTemplateAndtitle'][] = array( $flaggedrevs, 'parserFetchStableTemplate'); |
1169 | 1189 | $wgHooks['BeforeParserMakeImageLinkObj'][] = array( $flaggedrevs, 'parserMakeStableImageLink'); |
1170 | 1190 | ?> |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | * @param int $val |
94 | 94 | * Returns true if a user can do something |
95 | 95 | */ |
96 | | - function userCan( $tag, $value ) { |
| 96 | + public static function userCan( $tag, $value ) { |
97 | 97 | global $wgFlagRestrictions, $wgUser; |
98 | 98 | |
99 | 99 | if ( !isset($wgFlagRestrictions[$tag]) ) |