r68031 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68030‎ | r68031 | r68032 >
Date:20:49, 14 June 2010
Author:aaron
Status:ok
Tags:
Comment:
Avoid any type check problems from obtrusive User stubbing. The type of arguments called $user will have to be trusted as User for now.
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -551,7 +551,7 @@
552552 * @param User $user (optional)
553553 * @returns ParserOptions
554554 */
555 - public static function makeParserOptions( User $user = null ) {
 555+ public static function makeParserOptions( $user = null ) {
556556 global $wgUser;
557557 $user = $user ? $user : $wgUser; // assume current
558558 $options = ParserOptions::newFromUser( $user );
@@ -568,7 +568,7 @@
569569 * @return ParserOutput
570570 * Get the page cache for the top stable revision of an article
571571 */
572 - public static function getPageCache( Article $article, User $user ) {
 572+ public static function getPageCache( Article $article, $user ) {
573573 global $parserMemc, $wgCacheEpoch;
574574 wfProfileIn( __METHOD__ );
575575 # Make sure it is valid
@@ -616,7 +616,7 @@
617617 /**
618618 * Like ParserCache::getKey() with stable-pcache instead of pcache
619619 */
620 - public static function getCacheKey( $parserCache, Article $article, User $user ) {
 620+ public static function getCacheKey( $parserCache, Article $article, $user ) {
621621 $key = $parserCache->getKey( $article, $user );
622622 $key = str_replace( ':pcache:', ':stable-pcache:', $key );
623623 return $key;
@@ -629,7 +629,7 @@
630630 * Updates the stable cache of a page with the given $parserOut
631631 */
632632 public static function updatePageCache(
633 - Article $article, User $user, ParserOutput $parserOut = null
 633+ Article $article, $user, ParserOutput $parserOut = null
634634 ) {
635635 global $parserMemc, $wgParserCacheExpireTime, $wgEnableParserCache;
636636 # Make sure it is valid and $wgEnableParserCache is enabled
@@ -1479,7 +1479,7 @@
14801480 * If no appropriate tags can be found, then the review will abort.
14811481 */
14821482 public static function autoReviewEdit(
1483 - Article $article, User $user, $text, Revision $rev, array $flags = null, $auto = true
 1483+ Article $article, $user, $text, Revision $rev, array $flags = null, $auto = true
14841484 ) {
14851485 wfProfileIn( __METHOD__ );
14861486 $title = $article->getTitle();
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -260,7 +260,7 @@
261261 * Autoreview pages moved into content NS
262262 */
263263 public static function onTitleMoveComplete(
264 - Title $otitle, Title $ntitle, User $user, $pageId
 264+ Title $otitle, Title $ntitle, $user, $pageId
265265 ) {
266266 $fa = FlaggedArticle::getTitleInstance( $ntitle );
267267 // Re-validate NS/config (new title may not be reviewable)
@@ -798,7 +798,7 @@
799799 /**
800800 * Check page move and patrol permissions for FlaggedRevs
801801 */
802 - public static function onUserCan( Title $title, User $user, $action, &$result ) {
 802+ public static function onUserCan( Title $title, $user, $action, &$result ) {
803803 if ( $result === false ) {
804804 return true; // nothing to do
805805 }
@@ -849,7 +849,7 @@
850850 /**
851851 * Allow users to view reviewed pages
852852 */
853 - public static function userCanView( Title $title, User $user, $action, &$result ) {
 853+ public static function userCanView( Title $title, $user, $action, &$result ) {
854854 global $wgFlaggedRevsVisible, $wgFlaggedRevsTalkVisible, $wgTitle;
855855 # Assume $action may still not be set, in which case, treat it as 'view'...
856856 # Return out if $result set to false by some other hooked call.
@@ -980,7 +980,7 @@
981981 // Review $rev if $editTimestamp matches the previous revision's timestamp.
982982 // Otherwise, review the revision that has $editTimestamp as its timestamp value.
983983 protected static function editCheckReview(
984 - Article $article, $rev, User $user, $editTimestamp
 984+ Article $article, $rev, $user, $editTimestamp
985985 ) {
986986 $prevRevId = $rev->getParentId();
987987 $prevTimestamp = $flags = null;
@@ -1011,7 +1011,7 @@
10121012 * Check if a user reverted himself to the stable version
10131013 */
10141014 protected static function isSelfRevertToStable(
1015 - Revision $rev, $srev, $baseRevId, User $user
 1015+ Revision $rev, $srev, $baseRevId, $user
10161016 ) {
10171017 if ( !$srev || $baseRevId != $srev->getRevId() ) {
10181018 return false; // user reports they are not the same
@@ -1164,7 +1164,7 @@
11651165 }
11661166
11671167 public static function incrementRollbacks(
1168 - $article, User $user, $target, Revision $current
 1168+ $article, $user, $target, Revision $current
11691169 ) {
11701170 # Mark when a user reverts another user, but not self-reverts
11711171 if ( $current->getRawUser() && $user->getId() != $current->getRawUser() ) {
@@ -1200,7 +1200,7 @@
12011201 return true;
12021202 }
12031203
1204 - protected static function editSpacingCheck( $spacing, $points, User $user ) {
 1204+ protected static function editSpacingCheck( $spacing, $points, $user ) {
12051205 # Convert days to seconds...
12061206 $spacing = $spacing * 24 * 3600;
12071207 # Check the oldest edit
@@ -1230,7 +1230,7 @@
12311231 /**
12321232 * Checks if $user was previously blocked
12331233 */
1234 - public static function previousBlockCheck( User $user ) {
 1234+ public static function previousBlockCheck( $user ) {
12351235 $dbr = wfGetDB( DB_SLAVE );
12361236 return (bool)$dbr->selectField( 'logging', '1',
12371237 array(
@@ -1246,7 +1246,7 @@
12471247 /**
12481248 * Grant 'autoreview' rights to users with the 'bot' right
12491249 */
1250 - public static function onUserGetRights( User $user, array &$rights ) {
 1250+ public static function onUserGetRights( $user, array &$rights ) {
12511251 # Make sure bots always have the 'autoreview' right
12521252 if ( in_array( 'bot', $rights ) && !in_array( 'autoreview', $rights ) ) {
12531253 $rights[] = 'autoreview';
@@ -1261,7 +1261,7 @@
12621262 *
12631263 * Note: some unobtrusive caching is used to avoid DB hits.
12641264 */
1265 - public static function checkAutoPromote( User $user, array &$promote ) {
 1265+ public static function checkAutoPromote( $user, array &$promote ) {
12661266 global $wgFlaggedRevsAutoconfirm, $wgMemc;
12671267 # Check if $wgFlaggedRevsAutoconfirm is actually enabled
12681268 # and that this is a logged-in user that doesn't already
@@ -1374,7 +1374,7 @@
13751375 * $wgFlaggedRevsAutopromote. This also handles user stats tallies.
13761376 */
13771377 public static function maybeMakeEditor(
1378 - Article $article, User $user, $text, $summary, $m, $a, $b, &$f, $rev
 1378+ Article $article, $user, $text, $summary, $m, $a, $b, &$f, $rev
13791379 ) {
13801380 global $wgFlaggedRevsAutopromote, $wgFlaggedRevsAutoconfirm, $wgMemc;
13811381 # Ignore NULL edits or edits by anon users
@@ -1610,7 +1610,7 @@
16111611 }
16121612
16131613 /** Add user preferences */
1614 - public static function onGetPreferences( User $user, array &$preferences ) {
 1614+ public static function onGetPreferences( $user, array &$preferences ) {
16151615 // Box or bar UI
16161616 $preferences['flaggedrevssimpleui'] =
16171617 array(

Follow-up revisions

RevisionCommit summaryAuthorDate
r68032MFT r68019-r68031aaron20:56, 14 June 2010

Status & tagging log