r22591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22590‎ | r22591 | r22592 >
Date:05:35, 31 May 2007
Author:aaron
Status:old
Tags:
Comment:
*Some fixes
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -626,6 +626,24 @@
627627 $skip = true;
628628 }
629629 }
 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+ }
630648
631649 /**
632650 * Callback that autopromotes user according to the setting in
@@ -1164,6 +1182,8 @@
11651183 // Update our table NS/Titles when things are moved
11661184 $wgHooks['SpecialMovepageAfterMove'][] = array($flaggedrevs, 'updateFromMove');
11671185 // Parser hooks, selects the desired images/templates
 1186+$wgHooks['parserBeforerenderImageGallery'][] = array( $flaggedrevs, 'parserMakeGalleryStable');
 1187+$wgHooks['BeforeGalleryFindFile'][] = array( $flaggedrevs, 'galleryFindStableFileTime');
11681188 $wgHooks['BeforeParserFetchTemplateAndtitle'][] = array( $flaggedrevs, 'parserFetchStableTemplate');
11691189 $wgHooks['BeforeParserMakeImageLinkObj'][] = array( $flaggedrevs, 'parserMakeStableImageLink');
11701190 ?>
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php
@@ -92,7 +92,7 @@
9393 * @param int $val
9494 * Returns true if a user can do something
9595 */
96 - function userCan( $tag, $value ) {
 96+ public static function userCan( $tag, $value ) {
9797 global $wgFlagRestrictions, $wgUser;
9898
9999 if ( !isset($wgFlagRestrictions[$tag]) )