Merge "build: Replace jscs+jshint with eslint"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 16 Nov 2016 00:21:23 +0000 (00:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 16 Nov 2016 00:21:23 +0000 (00:21 +0000)
docs/hooks.txt
includes/auth/Throttler.php
includes/parser/Parser.php
tests/phpunit/includes/auth/ThrottlerTest.php

index 5b707c1..b8d9295 100644 (file)
@@ -2464,6 +2464,13 @@ $revId: ID of the revision that was parsed to create $parserOutput
 'ParserCloned': Called when the parser is cloned.
 $parser: Newly-cloned Parser object
 
+'ParserFetchTemplate': Called when the parser fetches a template
+$parser: Parser Parser object or false
+$title: Title object of the template to be fetched
+$rev: Revision object of the template
+&$text: Transclusion text of the template or false or null
+&$deps: Array of template dependencies with 'title', 'page_id', 'rev_id' keys
+
 'ParserFirstCallInit': Called when the parser initialises for the first time.
 &$parser: Parser object being cleared
 
index f47c606..000b070 100644 (file)
@@ -135,7 +135,7 @@ class Throttler implements LoggerAwareInterface {
                                $this->cache->incr( $throttleKey );
                        } else { // throttled
                                $this->logRejection( [
-                                       'type' => $this->type,
+                                       'throttle' => $this->type,
                                        'index' => $index,
                                        'ip' => $ipKey,
                                        'username' => $username,
@@ -191,7 +191,7 @@ class Throttler implements LoggerAwareInterface {
        }
 
        protected function logRejection( array $context ) {
-               $logMsg = 'Throttle {type} hit, throttled for {expiry} seconds due to {count} attempts '
+               $logMsg = 'Throttle {throttle} hit, throttled for {expiry} seconds due to {count} attempts '
                        . 'from username {username} and IP {ip}';
 
                // If we are hitting a throttle for >= warningLimit attempts, it is much more likely to be
index c7db8a1..10dfd26 100644 (file)
@@ -3599,6 +3599,9 @@ class Parser {
                                $content = $rev->getContent();
                                $text = $content ? $content->getWikitextForTransclusion() : null;
 
+                               Hooks::run( 'ParserFetchTemplate',
+                                       [ $parser, $title, $rev, &$text, &$deps ] );
+
                                if ( $text === false || $text === null ) {
                                        $text = false;
                                        break;
index 5806003..c945885 100644 (file)
@@ -196,7 +196,7 @@ class ThrottlerTest extends \MediaWikiTestCase {
                        ->setMethods( [ 'log' ] )
                        ->getMockForAbstractClass();
                $logger->expects( $this->once() )->method( 'log' )->with( $this->anything(), $this->anything(), [
-                       'type' => 'custom',
+                       'throttle' => 'custom',
                        'index' => 0,
                        'ip' => '1.2.3.4',
                        'username' => 'SomeUser',