Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -123,8 +123,6 @@ |
124 | 124 | * Update flaggedrevs table on article history merge |
125 | 125 | */ |
126 | 126 | public static function updateFromMerge( $sourceTitle, $destTitle ) { |
127 | | - wfProfileIn( __METHOD__ ); |
128 | | - |
129 | 127 | $oldPageID = $sourceTitle->getArticleID(); |
130 | 128 | $newPageID = $destTitle->getArticleID(); |
131 | 129 | # Get flagged revisions from old page id that point to destination page |
— | — | @@ -151,7 +149,6 @@ |
152 | 150 | FlaggedRevs::titleLinksUpdate( $sourceTitle ); |
153 | 151 | FlaggedRevs::titleLinksUpdate( $destTitle ); |
154 | 152 | |
155 | | - wfProfileOut( __METHOD__ ); |
156 | 153 | return true; |
157 | 154 | } |
158 | 155 | |
— | — | @@ -171,7 +168,6 @@ |
172 | 169 | if( !FlaggedRevs::isPageReviewable( $linksUpdate->mTitle ) ) { |
173 | 170 | return true; |
174 | 171 | } |
175 | | - wfProfileIn( __METHOD__ ); |
176 | 172 | $dbw = wfGetDB( DB_MASTER ); |
177 | 173 | $pageId = $linksUpdate->mTitle->getArticleId(); |
178 | 174 | # Check if this page has a stable version... |
— | — | @@ -181,7 +177,6 @@ |
182 | 178 | if( !$sv ) { |
183 | 179 | $dbw->delete( 'flaggedpages', array( 'fp_page_id' => $pageId ), __METHOD__ ); |
184 | 180 | $dbw->delete( 'flaggedrevs_tracking', array( 'ftr_from' => $pageId ), __METHOD__ ); |
185 | | - wfProfileOut( __METHOD__ ); |
186 | 181 | return true; |
187 | 182 | } |
188 | 183 | # Try the process cache... |
— | — | @@ -239,7 +234,6 @@ |
240 | 235 | if( count($insertions) ) { |
241 | 236 | $dbw->insert( 'flaggedrevs_tracking', $insertions, __METHOD__, 'IGNORE' ); |
242 | 237 | } |
243 | | - wfProfileOut( __METHOD__ ); |
244 | 238 | return true; |
245 | 239 | } |
246 | 240 | |
— | — | @@ -554,10 +548,9 @@ |
555 | 549 | */ |
556 | 550 | public static function parserInjectTimestamps( $parser, &$text ) { |
557 | 551 | # Don't trigger this for stable version parsing...it will do it separately. |
558 | | - if( !empty($parser->fr_isStable) ) |
| 552 | + if( !empty($parser->fr_isStable) ) { |
559 | 553 | return true; |
560 | | - |
561 | | - wfProfileIn( __METHOD__ ); |
| 554 | + } |
562 | 555 | $maxRevision = 0; |
563 | 556 | # Record the max template revision ID |
564 | 557 | if( !empty($parser->mOutput->mTemplateIds) ) { |
— | — | @@ -570,9 +563,8 @@ |
571 | 564 | } |
572 | 565 | } |
573 | 566 | $parser->mOutput->fr_newestTemplateID = $maxRevision; |
574 | | - |
575 | | - $maxTimestamp = "0"; |
576 | 567 | # Fetch the current timestamps of the images. |
| 568 | + $maxTimestamp = "0"; |
577 | 569 | if( !empty($parser->mOutput->mImages) ) { |
578 | 570 | foreach( $parser->mOutput->mImages as $filename => $x ) { |
579 | 571 | # FIXME: it would be nice not to double fetch these! |
— | — | @@ -591,8 +583,6 @@ |
592 | 584 | } |
593 | 585 | # Record the max timestamp |
594 | 586 | $parser->mOutput->fr_newestImageTime = $maxTimestamp; |
595 | | - |
596 | | - wfProfileOut( __METHOD__ ); |
597 | 587 | return true; |
598 | 588 | } |
599 | 589 | |
— | — | @@ -911,14 +901,11 @@ |
912 | 902 | */ |
913 | 903 | public static function checkAutoPromote( $user, &$promote ) { |
914 | 904 | global $wgFlaggedRevsAutopromote; |
915 | | - wfProfileIn( __METHOD__ ); |
916 | 905 | if( empty($wgFlaggedRevsAutopromote) || !$user->getId() || $user->isAllowed('autoreview') ) { |
917 | | - wfProfileOut( __METHOD__ ); |
918 | 906 | return true; // not needed |
919 | 907 | } |
920 | 908 | # Check user email |
921 | 909 | if( $wgFlaggedRevsAutopromote['email'] && !$user->isEmailConfirmed() ) { |
922 | | - wfProfileOut( __METHOD__ ); |
923 | 910 | return true; |
924 | 911 | } |
925 | 912 | # Get requirments |
— | — | @@ -929,17 +916,14 @@ |
930 | 917 | $usercreation = wfTimestampOrNull( TS_UNIX, $user->getRegistration() ); |
931 | 918 | $userage = $usercreation ? floor(($now - $usercreation) / 86400) : NULL; |
932 | 919 | if( !is_null($userage) && $userage < $timeReq ) { |
933 | | - wfProfileOut( __METHOD__ ); |
934 | 920 | return true; |
935 | 921 | } |
936 | 922 | # Check user edit count. Should be stored. |
937 | 923 | if( $user->getEditCount() < $editsReq ) { |
938 | | - wfProfileOut( __METHOD__ ); |
939 | 924 | return true; |
940 | 925 | } |
941 | 926 | # Add the right |
942 | 927 | $promote[] = 'autoreview'; |
943 | | - wfProfileOut( __METHOD__ ); |
944 | 928 | return true; |
945 | 929 | } |
946 | 930 | |
— | — | @@ -952,18 +936,15 @@ |
953 | 937 | if( empty($wgFlaggedRevsAutopromote) || !$rev || !$user->getId() ) |
954 | 938 | return true; |
955 | 939 | # Check implicitly sighted edits |
956 | | - wfProfileIn( __METHOD__ ); |
957 | 940 | # Grab current groups |
958 | 941 | $groups = $user->getGroups(); |
959 | 942 | # Do not give this to current holders or bots |
960 | 943 | if( $user->isAllowed('bot') || in_array('editor',$groups) ) { |
961 | | - wfProfileOut( __METHOD__ ); |
962 | 944 | return true; |
963 | 945 | } |
964 | 946 | # Do not re-add status if it was previously removed! |
965 | 947 | $p = FlaggedRevs::getUserParams( $user->getId() ); |
966 | 948 | if( isset($p['demoted']) && $p['demoted'] ) { |
967 | | - wfProfileOut( __METHOD__ ); |
968 | 949 | return true; |
969 | 950 | } |
970 | 951 | # Update any special counters for non-null revisions |
— | — | @@ -996,29 +977,24 @@ |
997 | 978 | $totalCheckedEditsNeeded = false; |
998 | 979 | if( $wgFlaggedRevsAutopromote['totalContentEdits'] > $p['totalContentEdits'] ) { |
999 | 980 | if( !$wgFlaggedRevsAutopromote['totalCheckedEdits'] ) { |
1000 | | - wfProfileOut( __METHOD__ ); |
1001 | 981 | return true; |
1002 | 982 | } |
1003 | 983 | $totalCheckedEditsNeeded = true; |
1004 | 984 | } |
1005 | 985 | # Check if user edited enough unique pages |
1006 | 986 | if( $wgFlaggedRevsAutopromote['uniqueContentPages'] > count($pages) ) { |
1007 | | - wfProfileOut( __METHOD__ ); |
1008 | 987 | return true; |
1009 | 988 | } |
1010 | 989 | # Check edit comment use |
1011 | 990 | if( $wgFlaggedRevsAutopromote['editComments'] > $p['editComments'] ) { |
1012 | | - wfProfileOut( __METHOD__ ); |
1013 | 991 | return true; |
1014 | 992 | } |
1015 | 993 | # Check reverted edits |
1016 | 994 | if( $wgFlaggedRevsAutopromote['maxRevertedEdits'] < $p['revertedEdits'] ) { |
1017 | | - wfProfileOut( __METHOD__ ); |
1018 | 995 | return true; |
1019 | 996 | } |
1020 | 997 | # Check user email |
1021 | 998 | if( $wgFlaggedRevsAutopromote['email'] && !$user->isEmailConfirmed() ) { |
1022 | | - wfProfileOut( __METHOD__ ); |
1023 | 999 | return true; |
1024 | 1000 | } |
1025 | 1001 | # Check account age |
— | — | @@ -1026,12 +1002,10 @@ |
1027 | 1003 | $usercreation = wfTimestampOrNull( TS_UNIX, $user->getRegistration() ); |
1028 | 1004 | $userage = $usercreation ? floor(($now - $usercreation) / 86400) : NULL; |
1029 | 1005 | if( !is_null($userage) && $userage < $wgFlaggedRevsAutopromote['days'] ) { |
1030 | | - wfProfileOut( __METHOD__ ); |
1031 | 1006 | return true; |
1032 | 1007 | } |
1033 | 1008 | # Check user edit count. Should be stored. |
1034 | 1009 | if( $user->getEditCount() < $wgFlaggedRevsAutopromote['edits'] ) { |
1035 | | - wfProfileOut( __METHOD__ ); |
1036 | 1010 | return true; |
1037 | 1011 | } |
1038 | 1012 | # Check if results are cached to avoid DB queries. |
— | — | @@ -1039,12 +1013,10 @@ |
1040 | 1014 | $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() ); |
1041 | 1015 | $value = $wgMemc->get( $key ); |
1042 | 1016 | if( $value == 'true' ) { |
1043 | | - wfProfileOut( __METHOD__ ); |
1044 | 1017 | return true; |
1045 | 1018 | } |
1046 | 1019 | # Don't grant to currently blocked users... |
1047 | 1020 | if( $user->isBlocked() ) { |
1048 | | - wfProfileOut( __METHOD__ ); |
1049 | 1021 | return true; |
1050 | 1022 | } |
1051 | 1023 | # Check if user was ever blocked before |
— | — | @@ -1060,14 +1032,12 @@ |
1061 | 1033 | if( $blocked ) { |
1062 | 1034 | # Make a key to store the results |
1063 | 1035 | $wgMemc->set( $key, 'true', 3600*24*7 ); |
1064 | | - wfProfileOut( __METHOD__ ); |
1065 | 1036 | return true; |
1066 | 1037 | } |
1067 | 1038 | } |
1068 | 1039 | # See if the page actually has sufficient content... |
1069 | 1040 | if( $wgFlaggedRevsAutopromote['userpageBytes'] > 0 ) { |
1070 | 1041 | if( !$user->getUserPage()->exists() ) { |
1071 | | - wfProfileOut( __METHOD__ ); |
1072 | 1042 | return true; |
1073 | 1043 | } |
1074 | 1044 | $dbr = isset($dbr) ? $dbr : wfGetDB( DB_SLAVE ); |
— | — | @@ -1076,7 +1046,6 @@ |
1077 | 1047 | 'page_title' => $user->getUserPage()->getDBKey() ), |
1078 | 1048 | __METHOD__ ); |
1079 | 1049 | if( $size < $wgFlaggedRevsAutopromote['userpageBytes'] ) { |
1080 | | - wfProfileOut( __METHOD__ ); |
1081 | 1050 | return true; |
1082 | 1051 | } |
1083 | 1052 | } |
— | — | @@ -1110,7 +1079,6 @@ |
1111 | 1080 | if( $benchmarks < $needed ) { |
1112 | 1081 | # Make a key to store the results |
1113 | 1082 | $wgMemc->set( $key, 'true', 3600*24*$spacing*($benchmarks - $needed - 1) ); |
1114 | | - wfProfileOut( __METHOD__ ); |
1115 | 1083 | return true; |
1116 | 1084 | } |
1117 | 1085 | } |
— | — | @@ -1127,7 +1095,6 @@ |
1128 | 1096 | if( $shared ) { |
1129 | 1097 | # Make a key to store the results |
1130 | 1098 | $wgMemc->set( $key, 'true', 3600*24*7 ); |
1131 | | - wfProfileOut( __METHOD__ ); |
1132 | 1099 | return true; |
1133 | 1100 | } |
1134 | 1101 | } |
— | — | @@ -1143,7 +1110,6 @@ |
1144 | 1111 | array( 'USE INDEX' => 'rc_ns_usertext', |
1145 | 1112 | 'LIMIT' => $wgFlaggedRevsAutopromote['recentContent'] ) ); |
1146 | 1113 | if( $dbr->numRows($res) < $wgFlaggedRevsAutopromote['recentContent'] ) { |
1147 | | - wfProfileOut( __METHOD__ ); |
1148 | 1114 | return true; |
1149 | 1115 | } |
1150 | 1116 | } |
— | — | @@ -1167,7 +1133,6 @@ |
1168 | 1134 | array( 'USE INDEX' => 'usertext_timestamp' ) ); |
1169 | 1135 | } |
1170 | 1136 | if( $deletedEdits >= $minDiff ) { |
1171 | | - wfProfileOut( __METHOD__ ); |
1172 | 1137 | return true; |
1173 | 1138 | } |
1174 | 1139 | } |
— | — | @@ -1181,7 +1146,6 @@ |
1182 | 1147 | 'LIMIT' => $wgFlaggedRevsAutopromote['totalCheckedEdits'] ) |
1183 | 1148 | ); |
1184 | 1149 | if( $dbr->numRows($res) < $wgFlaggedRevsAutopromote['totalCheckedEdits'] ) { |
1185 | | - wfProfileOut( __METHOD__ ); |
1186 | 1150 | return true; |
1187 | 1151 | } |
1188 | 1152 | } |
— | — | @@ -1196,7 +1160,6 @@ |
1197 | 1161 | array( implode(', ',$groups), implode(', ',$newGroups) ) ); |
1198 | 1162 | $user->addGroup('editor'); |
1199 | 1163 | |
1200 | | - wfProfileOut( __METHOD__ ); |
1201 | 1164 | return true; |
1202 | 1165 | } |
1203 | 1166 | |