r45445 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45444‎ | r45445 | r45446 >
Date:15:03, 6 January 2009
Author:aaron
Status:deferred
Tags:
Comment:
Move up some of the fast checks
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -862,14 +862,12 @@
863863 wfProfileOut( __METHOD__ );
864864 return true;
865865 }
866 - # Check if results are cached to avoid DB queries
867 - $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() );
868 - $value = $wgMemc->get( $key );
869 - if( $value == 'true' ) {
 866+ # Check user email
 867+ if( $wgFlaggedRevsAutopromote['email'] && !$user->isEmailConfirmed() ) {
870868 wfProfileOut( __METHOD__ );
871869 return true;
872870 }
873 - # Check basic, already available, promotion heuristics first...
 871+ # Check account age
874872 $now = time();
875873 $usercreation = wfTimestampOrNull( TS_UNIX, $user->getRegistration() );
876874 $userage = $usercreation ? floor(($now - $usercreation) / 86400) : NULL;
@@ -877,11 +875,16 @@
878876 wfProfileOut( __METHOD__ );
879877 return true;
880878 }
 879+ # Check user edit count. Should be stored.
881880 if( $user->getEditCount() < $wgFlaggedRevsAutopromote['edits'] ) {
882881 wfProfileOut( __METHOD__ );
883882 return true;
884883 }
885 - if( $wgFlaggedRevsAutopromote['email'] && !$user->isEmailConfirmed() ) {
 884+ # Check if results are cached to avoid DB queries.
 885+ # Checked basic, already available, promotion heuristics first...
 886+ $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() );
 887+ $value = $wgMemc->get( $key );
 888+ if( $value == 'true' ) {
886889 wfProfileOut( __METHOD__ );
887890 return true;
888891 }

Status & tagging log