From: Reedy Date: Wed, 22 Jan 2014 07:14:13 +0000 (+0000) Subject: Short circuit in notifyRCFeeds X-Git-Tag: 1.31.0-rc.0~17202 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=896149ec79d4d9f9f9ec1ba8a9b6972fa7bbf7a2;p=lhc%2Fweb%2Fwiklou.git Short circuit in notifyRCFeeds Save instantiating classes unnecesserily Add getEngine return type hint. Also make public Change-Id: Ie2610516f99fe7b01742e7e95e13c4b1b90c77d7 --- diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index f1f2578ca7..e71a2d5d2a 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -336,14 +336,6 @@ class RecentChange { global $wgRCFeeds; foreach ( $wgRCFeeds as $feed ) { - $engine = self::getEngine( $feed['uri'] ); - - if ( isset( $this->mExtra['actionCommentIRC'] ) ) { - $actionComment = $this->mExtra['actionCommentIRC']; - } else { - $actionComment = null; - } - $omitBots = isset( $feed['omit_bots'] ) ? $feed['omit_bots'] : false; if ( @@ -353,6 +345,14 @@ class RecentChange { continue; } + $engine = self::getEngine( $feed['uri'] ); + + if ( isset( $this->mExtra['actionCommentIRC'] ) ) { + $actionComment = $this->mExtra['actionCommentIRC']; + } else { + $actionComment = null; + } + /** @var $formatter RCFeedFormatter */ $formatter = new $feed['formatter'](); $line = $formatter->getLine( $feed, $this, $actionComment ); @@ -366,9 +366,9 @@ class RecentChange { * * @param string $uri URI to get the engine object for * @throws MWException - * @return object The engine object + * @return RCFeedEngine The engine object */ - private static function getEngine( $uri ) { + public static function getEngine( $uri ) { global $wgRCEngines; $scheme = parse_url( $uri, PHP_URL_SCHEME );