fix WikiPage::getDeletionUpdates() for cases where no content object is present.
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 24 Jul 2012 15:51:28 +0000 (17:51 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Tue, 24 Jul 2012 15:51:28 +0000 (17:51 +0200)
Change-Id: Idbd8dd9a4f84f45acfe1a4388653990cf191a33b

docs/hooks.txt
includes/WikiPage.php

index c42315e..0c69edc 100644 (file)
@@ -2409,6 +2409,7 @@ One, and only one hook should set this, and return false.
        Note that updates specific to a content model should be provided by the
        respective Content's getDeletionUpdates() method.
 $page: the WikiPage
+$content: the Content to generate updates for
 &$updates: the array of DataUpdate objects. Hook function may want to add to it.
 
 'wfShellWikiCmd': Called when generating a shell-escaped command line
index ea9c53d..4df8070 100644 (file)
@@ -3188,7 +3188,7 @@ class WikiPage extends Page {
        }
 
        /**
-        * Returns a list of updates to be performed when this page is deleted. The updates should remove any infomration
+        * Returns a list of updates to be performed when this page is deleted. The updates should remove any information
         * about this page from secondary data stores such as links tables.
         *
         * @param Content|null $content optional Content object for determining the necessary updates
@@ -3201,9 +3201,13 @@ class WikiPage extends Page {
                        $content = $this->getContent( Revision::RAW );
                }
 
-               $updates = $this->getContent()->getDeletionUpdates( $this->mTitle );
+               if ( !$content ) {
+                       $updates = array();
+               } else {
+                       $updates = $content->getDeletionUpdates( $this->mTitle );
+               }
 
-               wfRunHooks( 'WikiPageDeletionUpdates', array( $this, &$updates ) );
+               wfRunHooks( 'WikiPageDeletionUpdates', array( $this, $content, &$updates ) );
                return $updates;
        }