get deletion updates from content handler and hook
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 15 May 2012 07:08:16 +0000 (09:08 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Tue, 15 May 2012 07:08:16 +0000 (09:08 +0200)
docs/hooks.txt
includes/WikiPage.php

index e7d536a..405ee3d 100644 (file)
@@ -2341,6 +2341,13 @@ One, and only one hook should set this, and return false.
 &$opts: Options to use for the query
 &$join: Join conditions
 
+'WikiPageDeletionUpdates': manipulate the list of DataUpdates to be applied when
+       a page is deleted. Called in WikiPage::getDeletionUpdates().
+       Note that updates specific to a content model should be provided by the
+       respective ContentHandler's getDeletionUpdates() method.
+$page: the WikiPage
+&$updates: the array of DataUpdate objects. Hook function may want to add to it.
+
 'wfShellWikiCmd': Called when generating a shell-escaped command line
        string to run a MediaWiki cli script.
 &$script: MediaWiki cli script path
index 9755cf0..eaf32fe 100644 (file)
@@ -3194,12 +3194,9 @@ class WikiPage extends Page {
        }
 
        public function getDeletionUpdates() {
-               $updates = array(
-                       new LinksDeletionUpdate( $this ),
-               );
+               $updates = $this->getContentHandler()->getDeletionUpdates( $this );
 
-               //@todo: make a hook to add update objects
-               //NOTE: deletion updates will be determined by the ContentHandler in the future
+               wfRunHooks( 'WikiPageDeletionUpdates', array( $this, &$updates ) );
                return $updates;
        }
 }