Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -166,6 +166,7 @@ |
167 | 167 | 'userpage' => true, # user must have a userpage? |
168 | 168 | 'userpageBytes' => 100, # if userpage is needed, what is the min size? |
169 | 169 | 'uniqueIPAddress' => true, # If $wgPutIPinRC is true, users sharing IPs won't be promoted |
| 170 | + 'neverBlocked' => true, # Can user that were blocked be promoted? |
170 | 171 | 'noSorbsMatches' => false, # If $wgSorbsUrl is set, do not promote users that match |
171 | 172 | ); |
172 | 173 | |
— | — | @@ -2023,7 +2024,6 @@ |
2024 | 2025 | return true; |
2025 | 2026 | } |
2026 | 2027 | # Do not re-add status if it was previously removed! |
2027 | | - # A special entry is made in the log whenever an editor looses their rights. |
2028 | 2028 | $p = self::getUserParams( $user ); |
2029 | 2029 | if( isset($params['demoted']) && $params['demoted'] ) { |
2030 | 2030 | wfProfileOut( __METHOD__ ); |
— | — | @@ -2096,13 +2096,30 @@ |
2097 | 2097 | wfProfileOut( __METHOD__ ); |
2098 | 2098 | return true; |
2099 | 2099 | } |
| 2100 | + # Check if user was ever blocked before |
| 2101 | + if( $wgFlaggedRevsAutopromote['neverBlocked'] ) { |
| 2102 | + $dbr = wfGetDB( DB_SLAVE ); |
| 2103 | + $blocked = $dbr->selectField( 'logging', '1', |
| 2104 | + array( 'log_namespace' => NS_USER, |
| 2105 | + 'log_title' => $user->getUserPage()->getDBKey(), |
| 2106 | + 'log_type' => 'block', |
| 2107 | + 'log_action' => 'block' ), |
| 2108 | + __METHOD__, |
| 2109 | + array( 'USE INDEX' => 'user_time' ) ); |
| 2110 | + if( $blocked ) { |
| 2111 | + # Make a key to store the results |
| 2112 | + $wgMemc->set( $key, 'true', 3600*24*7 ); |
| 2113 | + wfProfileOut( __METHOD__ ); |
| 2114 | + return true; |
| 2115 | + } |
| 2116 | + } |
2100 | 2117 | # See if the page actually has sufficient content... |
2101 | 2118 | if( $wgFlaggedRevsAutopromote['userpage'] ) { |
2102 | 2119 | if( !$user->getUserPage()->exists() ) { |
2103 | 2120 | wfProfileOut( __METHOD__ ); |
2104 | 2121 | return true; |
2105 | 2122 | } |
2106 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 2123 | + $dbr = isset($dbr) ? $dbr : wfGetDB( DB_SLAVE ); |
2107 | 2124 | $size = $dbr->selectField( 'page', 'page_len', |
2108 | 2125 | array( 'page_namespace' => $user->getUserPage()->getNamespace(), |
2109 | 2126 | 'page_title' => $user->getUserPage()->getDBKey() ), |
— | — | @@ -2141,7 +2158,6 @@ |
2142 | 2159 | } |
2143 | 2160 | if( $benchmarks < $needed ) { |
2144 | 2161 | # Make a key to store the results |
2145 | | - $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() ); |
2146 | 2162 | $wgMemc->set( $key, 'true', 3600*24*$spacing*($benchmarks - $needed - 1) ); |
2147 | 2163 | wfProfileOut( __METHOD__ ); |
2148 | 2164 | return true; |
— | — | @@ -2159,7 +2175,6 @@ |
2160 | 2176 | array( 'USE INDEX' => 'rc_ip' ) ); |
2161 | 2177 | if( $shared ) { |
2162 | 2178 | # Make a key to store the results |
2163 | | - $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() ); |
2164 | 2179 | $wgMemc->set( $key, 'true', 3600*24*7 ); |
2165 | 2180 | wfProfileOut( __METHOD__ ); |
2166 | 2181 | return true; |
— | — | @@ -2171,7 +2186,6 @@ |
2172 | 2187 | $ip = wfGetIP(); |
2173 | 2188 | if( !in_array($ip,$wgProxyWhitelist) && $user->inDnsBlacklist( $ip, $wgSorbsUrl ) ) { |
2174 | 2189 | # Make a key to store the results |
2175 | | - $key = wfMemcKey( 'flaggedrevs', 'autopromote-skip', $user->getID() ); |
2176 | 2190 | $wgMemc->set( $key, 'true', 3600*24*7 ); |
2177 | 2191 | wfProfileOut( __METHOD__ ); |
2178 | 2192 | return true; |