https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113585

Revision: 113585
Author:   reedy
Date:     2012-03-11 20:32:31 +0000 (Sun, 11 Mar 2012)
Log Message:
-----------
Documentation

Ping r111217, fix $fdb, rename it $dbw

Modified Paths:
--------------
    trunk/extensions/AbuseFilter/AbuseFilter.hooks.php

Modified: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
===================================================================
--- trunk/extensions/AbuseFilter/AbuseFilter.hooks.php  2012-03-11 20:06:20 UTC 
(rev 113584)
+++ trunk/extensions/AbuseFilter/AbuseFilter.hooks.php  2012-03-11 20:32:31 UTC 
(rev 113585)
@@ -4,6 +4,10 @@
 }
 
 class AbuseFilterHooks {
+
+       /**
+        * @var AbuseFilterVariableHolder
+        */
        static $successful_action_vars = false;
        // So far, all of the error message out-params for these hooks accept 
HTML.
        // Hooray!
@@ -12,8 +16,8 @@
         * Entry points for MediaWiki hook 'EditFilterMerged'
         *
         * @param $editor EditPage instance (object)
-        * @param $text Content of the edit box
-        * @param &$error Error message to return
+        * @param $text string Content of the edit box
+        * @param &$error string Error message to return
         * @param $summary Edit summary for page
         * @return bool
         */
@@ -68,6 +72,18 @@
                return true;
        }
 
+       /**
+        * @param $article Article
+        * @param $user User
+        * @param $text string
+        * @param $summary string
+        * @param $minoredit bool
+        * @param $watchthis bool
+        * @param $sectionanchor
+        * @param $flags
+        * @param $revision Revision
+        * @return bool
+        */
        public static function onArticleSaveComplete(
                &$article, &$user, $text, $summary, $minoredit, $watchthis, 
$sectionanchor,
                &$flags, $revision
@@ -102,7 +118,7 @@
                        $log_ids = $vars->getVar('global_log_ids')->toNative();
 
                        global $wgAbuseFilterCentralDB;
-                       $fdb = wfGetDB( DB_MASTER, array(), 
$wgAbuseFilterCentralDB );
+                       $dbw = wfGetDB( DB_MASTER, array(), 
$wgAbuseFilterCentralDB );
 
                        if ( count($log_ids) ) {
                                $dbw->update( 'abuse_filter_log',
@@ -116,6 +132,11 @@
                return true;
        }
 
+       /**
+        * @param $user
+        * @param $promote
+        * @return bool
+        */
        public static function onGetAutoPromoteGroups( $user, &$promote ) {
                global $wgMemc;
 
@@ -128,6 +149,14 @@
                return true;
        }
 
+       /**
+        * @param $oldTitle Title
+        * @param $newTitle Title
+        * @param $user User
+        * @param $error
+        * @param $reason
+        * @return bool
+        */
        public static function onAbortMove( $oldTitle, $newTitle, $user, 
&$error, $reason ) {
                $vars = new AbuseFilterVariableHolder;
 
@@ -149,22 +178,34 @@
                return $filter_result == '' || $filter_result === true;
        }
 
+       /**
+        * @param $article Article
+        * @param $user User
+        * @param $reason string
+        * @param $error
+        * @return bool
+        */
        public static function onArticleDelete( &$article, &$user, &$reason, 
&$error ) {
                $vars = new AbuseFilterVariableHolder;
 
                global $wgUser;
                $vars->addHolder( AbuseFilter::generateUserVars( $wgUser ) );
-               $vars->addHolder( AbuseFilter::generateTitleVars( 
$article->mTitle, 'ARTICLE' ) );
+               $vars->addHolder( AbuseFilter::generateTitleVars( 
$article->getTitle(), 'ARTICLE' ) );
                $vars->setVar( 'SUMMARY', $reason );
                $vars->setVar( 'ACTION', 'delete' );
 
-               $filter_result = AbuseFilter::filterAction( $vars, 
$article->mTitle );
+               $filter_result = AbuseFilter::filterAction( $vars, 
$article->getTitle() );
 
                $error = $filter_result;
 
                return $filter_result == '' || $filter_result === true;
        }
 
+       /**
+        * @param $user User
+        * @param $message
+        * @return bool
+        */
        public static function onAbortNewAccount( $user, &$message ) {
                if ( $user->getName() == wfMsgForContent( 'abusefilter-blocker' 
) ) {
                        $message = wfMsg( 'abusefilter-accountreserved' );
@@ -189,10 +230,14 @@
                return $filter_result == '' || $filter_result === true;
        }
 
+       /**
+        * @param $recentChange RecentChange
+        * @return bool
+        */
        public static function onRecentChangeSave( $recentChange ) {
                $title = Title::makeTitle(
-                       $recentChange->mAttribs['rc_namespace'],
-                       $recentChange->mAttribs['rc_title']
+                       $recentChange->getAttribute( 'rc_namespace' ),
+                       $recentChange->getAttribute( 'rc_title' )
                );
                $action = $recentChange->mAttribs['rc_log_type'] ?
                        $recentChange->mAttribs['rc_log_type'] : 'edit';
@@ -214,6 +259,10 @@
                return true;
        }
 
+       /**
+        * @param $emptyTags array
+        * @return bool
+        */
        public static function onListDefinedTags( &$emptyTags ) {
                # This is a pretty awful hack.
                $dbr = wfGetDB( DB_SLAVE );
@@ -238,6 +287,7 @@
 
        /**
         * @param $updater DatabaseUpdater
+        * @throws MWException
         * @return bool
         */
        public static function onLoadExtensionSchemaUpdates( $updater = null ) {
@@ -299,11 +349,16 @@
                return true;
        }
 
+       /**
+        * @param $id
+        * @param $nt Title
+        * @param $tools
+        * @return bool
+        */
        public static function onContributionsToolLinks( $id, $nt, &$tools ) {
                global $wgUser;
                if ( $wgUser->isAllowed( 'abusefilter-log' ) ) {
-                       $sk = $wgUser->getSkin();
-                       $tools[] = $sk->link(
+                               $tools[] = Linker::link(
                                SpecialPage::getTitleFor( 'AbuseLog' ),
                                wfMsg( 'abusefilter-log-linkoncontribs' ),
                                array( 'title' =>
@@ -314,6 +369,12 @@
                return true;
        }
 
+       /**
+        * @param $saveName
+        * @param $tempName
+        * @param $error
+        * @return bool
+        */
        public static function onUploadVerification( $saveName, $tempName, 
&$error ) {
                $vars = new AbuseFilterVariableHolder;
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to