Import: Fix incorrect wfRunHooks usage
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 26 Apr 2013 20:35:20 +0000 (00:35 +0400)
committerKrinkle <krinklemail@gmail.com>
Thu, 2 May 2013 18:06:19 +0000 (18:06 +0000)
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
includes/Import.php

index 320a57d..9aea5ad 100644 (file)
@@ -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 );
 }
 
index bf5a3fb..7b078db 100644 (file)
@@ -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();