From 1f8a7dc2d2b0916bdd3bbb5a8b7660d3e026b03a Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 27 Apr 2013 00:35:20 +0400 Subject: [PATCH] Import: Fix incorrect wfRunHooks usage af125df5199b5c232bf335d735cecc6d8f8e9784 broke importing because Import.php was calling wfRunHooks() improperly. Fixing the calls and making the wfRunHooks() signature match Hooks::run() to make call errors immediately detectable. Change-Id: If44292fedf6917cde1dae7f0391231a18d414610 --- includes/GlobalFunctions.php | 2 +- includes/Import.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 320a57d01a..9aea5ad409 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3868,7 +3868,7 @@ function wfGetLangConverterCacheStorage() { * @param array $args parameters passed to hook functions * @return Boolean True if no handler aborted the hook */ -function wfRunHooks( $event, $args = array() ) { +function wfRunHooks( $event, array $args = array() ) { return Hooks::run( $event, $args ); } diff --git a/includes/Import.php b/includes/Import.php index bf5a3fb4d6..7b078dbf10 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -463,7 +463,7 @@ class WikiImporter { $tag = $this->reader->name; $type = $this->reader->nodeType; - if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', $this ) ) { + if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', array( $this ) ) ) { // Do nothing } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) { break; @@ -522,8 +522,9 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', - $this, $logInfo ) ) { + if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', array( + $this, $logInfo + ) ) ) { // Do nothing } elseif ( in_array( $tag, $normalFields ) ) { $logInfo[$tag] = $this->nodeContents(); @@ -639,8 +640,9 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', $this, - $pageInfo, $revisionInfo ) ) { + if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', array( + $this, $pageInfo, $revisionInfo + ) ) ) { // Do nothing } elseif ( in_array( $tag, $normalFields ) ) { $revisionInfo[$tag] = $this->nodeContents(); @@ -725,8 +727,9 @@ class WikiImporter { $tag = $this->reader->name; - if ( !wfRunHooks( 'ImportHandleUploadXMLTag', $this, - $pageInfo ) ) { + if ( !wfRunHooks( 'ImportHandleUploadXMLTag', array( + $this, $pageInfo + ) ) ) { // Do nothing } elseif ( in_array( $tag, $normalFields ) ) { $uploadInfo[$tag] = $this->nodeContents(); -- 2.20.1