Index: trunk/extensions/SpamBlacklist/SpamBlacklist.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | |
71 | 71 | $spamObj = wfSpamBlacklistObject(); |
72 | 72 | if( !$spamObj->isLocalSource( $editPage->mTitle ) ) { |
73 | | - wfDebug( "Spam blacklist validator: [[$thisPageName]] not a local blacklist\n" ); |
| 73 | + wfDebugLog( 'SpamBlacklist', "Spam blacklist validator: [[$thisPageName]] not a local blacklist\n" ); |
74 | 74 | return true; |
75 | 75 | } |
76 | 76 | |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | |
79 | 79 | $badLines = SpamRegexBatch::getBadLines( $lines ); |
80 | 80 | if( $badLines ) { |
81 | | - wfDebug( "Spam blacklist validator: [[$thisPageName]] given invalid input lines: " . |
| 81 | + wfDebugLog( 'SpamBlacklist', "Spam blacklist validator: [[$thisPageName]] given invalid input lines: " . |
82 | 82 | implode( ', ', $badLines ) . "\n" ); |
83 | 83 | |
84 | 84 | $badList = "*<tt>" . |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | "<br clear='all' />\n"; |
94 | 94 | return true; |
95 | 95 | } else { |
96 | | - wfDebug( "Spam blacklist validator: [[$thisPageName]] ok or empty blacklist\n" ); |
| 96 | + wfDebugLog( 'SpamBlacklist', "Spam blacklist validator: [[$thisPageName]] ok or empty blacklist\n" ); |
97 | 97 | return true; |
98 | 98 | } |
99 | 99 | } |
Index: trunk/extensions/SpamBlacklist/SpamBlacklist_body.php |
— | — | @@ -86,11 +86,11 @@ |
87 | 87 | $fname = 'SpamBlacklist::getRegex'; |
88 | 88 | wfProfileIn( $fname ); |
89 | 89 | |
90 | | - wfDebug( "Loading spam regex..." ); |
| 90 | + wfDebugLog( 'SpamBlacklist', "Loading spam regex..." ); |
91 | 91 | |
92 | 92 | if ( count( $this->files ) == 0 ){ |
93 | 93 | # No lists |
94 | | - wfDebug( "no files specified\n" ); |
| 94 | + wfDebugLog( 'SpamBlacklist', "no files specified\n" ); |
95 | 95 | wfProfileOut( $fname ); |
96 | 96 | return array(); |
97 | 97 | } |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | // server where not all wikis have the same configuration. |
101 | 101 | $cachedRegexes = $wgMemc->get( "$wgDBname:spam_blacklist_regexes" ); |
102 | 102 | if( is_array( $cachedRegexes ) ) { |
103 | | - wfDebug( "Got shared spam regexes from cache\n" ); |
| 103 | + wfDebugLog( 'SpamBlacklist', "Got shared spam regexes from cache\n" ); |
104 | 104 | wfProfileOut( $fname ); |
105 | 105 | return $cachedRegexes; |
106 | 106 | } |
— | — | @@ -113,13 +113,13 @@ |
114 | 114 | function clearCache() { |
115 | 115 | global $wgMemc, $wgDBname; |
116 | 116 | $wgMemc->delete( "$wgDBname:spam_blacklist_regexes" ); |
117 | | - wfDebug( "Spam blacklist local cache cleared.\n" ); |
| 117 | + wfDebugLog( 'SpamBlacklist', "Spam blacklist local cache cleared.\n" ); |
118 | 118 | } |
119 | 119 | |
120 | 120 | function buildSharedBlacklists() { |
121 | 121 | $regexes = array(); |
122 | 122 | # Load lists |
123 | | - wfDebug( "Constructing spam blacklist\n" ); |
| 123 | + wfDebugLog( 'SpamBlacklist', "Constructing spam blacklist\n" ); |
124 | 124 | foreach ( $this->files as $fileName ) { |
125 | 125 | if ( preg_match( '/^DB: ([\w-]*) (.*)$/', $fileName, $matches ) ) { |
126 | 126 | $text = $this->getArticleText( $matches[1], $matches[2] ); |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | $text = $this->getHttpText( $fileName ); |
129 | 129 | } else { |
130 | 130 | $text = file_get_contents( $fileName ); |
131 | | - wfDebug( "got from file $fileName\n" ); |
| 131 | + wfDebugLog( 'SpamBlacklist', "got from file $fileName\n" ); |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Build a separate batch of regexes from each source. |
— | — | @@ -159,15 +159,15 @@ |
160 | 160 | $warning = $messageMemc->get( $warningKey ); |
161 | 161 | |
162 | 162 | if ( !is_string( $httpText ) || ( !$warning && !mt_rand( 0, $this->warningChance ) ) ) { |
163 | | - wfDebug( "Loading spam blacklist from $fileName\n" ); |
| 163 | + wfDebugLog( 'SpamBlacklist', "Loading spam blacklist from $fileName\n" ); |
164 | 164 | $httpText = $this->getHTTP( $fileName ); |
165 | 165 | if( $httpText === false ) { |
166 | | - wfDebug( "Error loading blacklist from $fileName\n" ); |
| 166 | + wfDebugLog( 'SpamBlacklist', "Error loading blacklist from $fileName\n" ); |
167 | 167 | } |
168 | 168 | $messageMemc->set( $warningKey, 1, $this->warningTime ); |
169 | 169 | $messageMemc->set( $key, $httpText, $this->expiryTime ); |
170 | 170 | } else { |
171 | | - wfDebug( "Got spam blacklist from HTTP cache for $fileName\n" ); |
| 171 | + wfDebugLog( 'SpamBlacklist', "Got spam blacklist from HTTP cache for $fileName\n" ); |
172 | 172 | } |
173 | 173 | return $httpText; |
174 | 174 | } |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | |
214 | 214 | # Strip whitelisted URLs from the match |
215 | 215 | if( is_array( $whitelists ) ) { |
216 | | - wfDebug( "Excluding whitelisted URLs from " . count( $whitelists ) . |
| 216 | + wfDebugLog( 'SpamBlacklist', "Excluding whitelisted URLs from " . count( $whitelists ) . |
217 | 217 | " regexes: " . implode( ', ', $whitelists ) . "\n" ); |
218 | 218 | foreach( $whitelists as $regex ) { |
219 | 219 | wfSuppressWarnings(); |
— | — | @@ -222,7 +222,7 @@ |
223 | 223 | } |
224 | 224 | |
225 | 225 | # Do the match |
226 | | - wfDebug( "Checking text against " . count( $blacklists ) . |
| 226 | + wfDebugLog( 'SpamBlacklist', "Checking text against " . count( $blacklists ) . |
227 | 227 | " regexes: " . implode( ', ', $blacklists ) . "\n" ); |
228 | 228 | $retVal = false; |
229 | 229 | foreach( $blacklists as $regex ) { |
— | — | @@ -230,7 +230,7 @@ |
231 | 231 | $check = preg_match( $regex, $links, $matches ); |
232 | 232 | wfRestoreWarnings(); |
233 | 233 | if( $check ) { |
234 | | - wfDebug( "Match!\n" ); |
| 234 | + wfDebugLog( 'SpamBlacklist', "Match!\n" ); |
235 | 235 | EditPage::spamPage( $matches[0] ); |
236 | 236 | $retVal = true; |
237 | 237 | break; |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | * @param string $article |
253 | 253 | */ |
254 | 254 | function getArticleText( $db, $article ) { |
255 | | - wfDebug( "Fetching local spam blacklist from '$article' on '$db'...\n" ); |
| 255 | + wfDebugLog( 'SpamBlacklist', "Fetching local spam blacklist from '$article' on '$db'...\n" ); |
256 | 256 | global $wgDBname; |
257 | 257 | $dbr = wfGetDB( DB_READ ); |
258 | 258 | $dbr->selectDB( $db ); |
— | — | @@ -386,7 +386,7 @@ |
387 | 387 | // slower if there's a lot of blacklist lines, but one |
388 | 388 | // broken line won't take out hundreds of its brothers. |
389 | 389 | if( $fileName ) { |
390 | | - wfDebug( "Spam blacklist warning: bogus line in $fileName\n" ); |
| 390 | + wfDebugLog( 'SpamBlacklist', "Spam blacklist warning: bogus line in $fileName\n" ); |
391 | 391 | } |
392 | 392 | return SpamRegexBatch::buildRegexes( $lines, 0 ); |
393 | 393 | } |