From: Jackmcbarn Date: Mon, 15 Sep 2014 22:46:25 +0000 (-0400) Subject: Add TitleExists hook X-Git-Tag: 1.31.0-rc.0~13983^2 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=c15616690ede375e3dd36d6ea020b9d3db17aac8;p=lhc%2Fweb%2Fwiklou.git Add TitleExists hook Bug: 70495 Change-Id: I4f9a04d09ff8c4bdda678a591aea7f1153cb0a40 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 9ac2271d54..5be770e82f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2590,6 +2590,10 @@ database result. &$titleArray: set this to an object to override the default object returned $res: database result used to create the object +'TitleExists': Called when determining whether a page exists at a given title. +$title: The title being tested. +&$exists: Whether the title exists. + 'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to or override the quick permissions check. $title: The Title object being accessed diff --git a/includes/Title.php b/includes/Title.php index 7959860f9b..8ffea3557b 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4608,7 +4608,9 @@ class Title { * @return bool */ public function exists() { - return $this->getArticleID() != 0; + $exists = $this->getArticleID() != 0; + wfRunHooks( 'TitleExists', array( $this, &$exists ) ); + return $exists; } /**