From 086f7191163f760c97a86083c1329cacf265775c Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 24 Jul 2012 17:51:28 +0200 Subject: [PATCH] fix WikiPage::getDeletionUpdates() for cases where no content object is present. Change-Id: Idbd8dd9a4f84f45acfe1a4388653990cf191a33b --- docs/hooks.txt | 1 + includes/WikiPage.php | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index c42315e351..0c69edc858 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/WikiPage.php b/includes/WikiPage.php index ea9c53d27f..4df80705a0 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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; } -- 2.20.1