r113585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113584‎ | r113585 | r113586 >
Date:20:32, 11 March 2012
Author:reedy
Status:reverted
Tags:gerritmigration 
Comment:
Documentation

Ping r111217, fix $fdb, rename it $dbw
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -4,6 +4,10 @@
55 }
66
77 class AbuseFilterHooks {
 8+
 9+ /**
 10+ * @var AbuseFilterVariableHolder
 11+ */
812 static $successful_action_vars = false;
913 // So far, all of the error message out-params for these hooks accept HTML.
1014 // Hooray!
@@ -12,8 +16,8 @@
1317 * Entry points for MediaWiki hook 'EditFilterMerged'
1418 *
1519 * @param $editor EditPage instance (object)
16 - * @param $text Content of the edit box
17 - * @param &$error Error message to return
 20+ * @param $text string Content of the edit box
 21+ * @param &$error string Error message to return
1822 * @param $summary Edit summary for page
1923 * @return bool
2024 */
@@ -68,6 +72,18 @@
6973 return true;
7074 }
7175
 76+ /**
 77+ * @param $article Article
 78+ * @param $user User
 79+ * @param $text string
 80+ * @param $summary string
 81+ * @param $minoredit bool
 82+ * @param $watchthis bool
 83+ * @param $sectionanchor
 84+ * @param $flags
 85+ * @param $revision Revision
 86+ * @return bool
 87+ */
7288 public static function onArticleSaveComplete(
7389 &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor,
7490 &$flags, $revision
@@ -102,7 +118,7 @@
103119 $log_ids = $vars->getVar('global_log_ids')->toNative();
104120
105121 global $wgAbuseFilterCentralDB;
106 - $fdb = wfGetDB( DB_MASTER, array(), $wgAbuseFilterCentralDB );
 122+ $dbw = wfGetDB( DB_MASTER, array(), $wgAbuseFilterCentralDB );
107123
108124 if ( count($log_ids) ) {
109125 $dbw->update( 'abuse_filter_log',
@@ -116,6 +132,11 @@
117133 return true;
118134 }
119135
 136+ /**
 137+ * @param $user
 138+ * @param $promote
 139+ * @return bool
 140+ */
120141 public static function onGetAutoPromoteGroups( $user, &$promote ) {
121142 global $wgMemc;
122143
@@ -128,6 +149,14 @@
129150 return true;
130151 }
131152
 153+ /**
 154+ * @param $oldTitle Title
 155+ * @param $newTitle Title
 156+ * @param $user User
 157+ * @param $error
 158+ * @param $reason
 159+ * @return bool
 160+ */
132161 public static function onAbortMove( $oldTitle, $newTitle, $user, &$error, $reason ) {
133162 $vars = new AbuseFilterVariableHolder;
134163
@@ -149,22 +178,34 @@
150179 return $filter_result == '' || $filter_result === true;
151180 }
152181
 182+ /**
 183+ * @param $article Article
 184+ * @param $user User
 185+ * @param $reason string
 186+ * @param $error
 187+ * @return bool
 188+ */
153189 public static function onArticleDelete( &$article, &$user, &$reason, &$error ) {
154190 $vars = new AbuseFilterVariableHolder;
155191
156192 global $wgUser;
157193 $vars->addHolder( AbuseFilter::generateUserVars( $wgUser ) );
158 - $vars->addHolder( AbuseFilter::generateTitleVars( $article->mTitle, 'ARTICLE' ) );
 194+ $vars->addHolder( AbuseFilter::generateTitleVars( $article->getTitle(), 'ARTICLE' ) );
159195 $vars->setVar( 'SUMMARY', $reason );
160196 $vars->setVar( 'ACTION', 'delete' );
161197
162 - $filter_result = AbuseFilter::filterAction( $vars, $article->mTitle );
 198+ $filter_result = AbuseFilter::filterAction( $vars, $article->getTitle() );
163199
164200 $error = $filter_result;
165201
166202 return $filter_result == '' || $filter_result === true;
167203 }
168204
 205+ /**
 206+ * @param $user User
 207+ * @param $message
 208+ * @return bool
 209+ */
169210 public static function onAbortNewAccount( $user, &$message ) {
170211 if ( $user->getName() == wfMsgForContent( 'abusefilter-blocker' ) ) {
171212 $message = wfMsg( 'abusefilter-accountreserved' );
@@ -189,10 +230,14 @@
190231 return $filter_result == '' || $filter_result === true;
191232 }
192233
 234+ /**
 235+ * @param $recentChange RecentChange
 236+ * @return bool
 237+ */
193238 public static function onRecentChangeSave( $recentChange ) {
194239 $title = Title::makeTitle(
195 - $recentChange->mAttribs['rc_namespace'],
196 - $recentChange->mAttribs['rc_title']
 240+ $recentChange->getAttribute( 'rc_namespace' ),
 241+ $recentChange->getAttribute( 'rc_title' )
197242 );
198243 $action = $recentChange->mAttribs['rc_log_type'] ?
199244 $recentChange->mAttribs['rc_log_type'] : 'edit';
@@ -214,6 +259,10 @@
215260 return true;
216261 }
217262
 263+ /**
 264+ * @param $emptyTags array
 265+ * @return bool
 266+ */
218267 public static function onListDefinedTags( &$emptyTags ) {
219268 # This is a pretty awful hack.
220269 $dbr = wfGetDB( DB_SLAVE );
@@ -238,6 +287,7 @@
239288
240289 /**
241290 * @param $updater DatabaseUpdater
 291+ * @throws MWException
242292 * @return bool
243293 */
244294 public static function onLoadExtensionSchemaUpdates( $updater = null ) {
@@ -299,11 +349,16 @@
300350 return true;
301351 }
302352
 353+ /**
 354+ * @param $id
 355+ * @param $nt Title
 356+ * @param $tools
 357+ * @return bool
 358+ */
303359 public static function onContributionsToolLinks( $id, $nt, &$tools ) {
304360 global $wgUser;
305361 if ( $wgUser->isAllowed( 'abusefilter-log' ) ) {
306 - $sk = $wgUser->getSkin();
307 - $tools[] = $sk->link(
 362+ $tools[] = Linker::link(
308363 SpecialPage::getTitleFor( 'AbuseLog' ),
309364 wfMsg( 'abusefilter-log-linkoncontribs' ),
310365 array( 'title' =>
@@ -314,6 +369,12 @@
315370 return true;
316371 }
317372
 373+ /**
 374+ * @param $saveName
 375+ * @param $tempName
 376+ * @param $error
 377+ * @return bool
 378+ */
318379 public static function onUploadVerification( $saveName, $tempName, &$error ) {
319380 $vars = new AbuseFilterVariableHolder;
320381

Follow-up revisions

RevisionCommit summaryAuthorDate
r114396Revert r111217 (unreviewed rev in AbuseFilter) and its dependencies r113585, ...catrope19:41, 21 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111217AbuseFilter: Resolve bugs 18374, 28633....werdna23:41, 10 February 2012

Status & tagging log