From c15616690ede375e3dd36d6ea020b9d3db17aac8 Mon Sep 17 00:00:00 2001 From: Jackmcbarn Date: Mon, 15 Sep 2014 18:46:25 -0400 Subject: [PATCH] Add TitleExists hook Bug: 70495 Change-Id: I4f9a04d09ff8c4bdda678a591aea7f1153cb0a40 --- docs/hooks.txt | 4 ++++ includes/Title.php | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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; } /** -- 2.20.1