From 29ceb0c78a641a2c936432d32582903562eced80 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Mon, 30 Jan 2012 12:52:31 +0000 Subject: [PATCH] add hook that allows changing the check to see if a page exists or not --- includes/Title.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index b91c55c1d8..fd72309c2f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -28,7 +28,8 @@ * * @internal documentation reviewed 15 Mar 2010 */ -class Title { +class +Title { /** @name Static cache variables */ // @{ static private $titleCache = array(); @@ -4164,7 +4165,21 @@ class Title { * @return Bool */ public function isKnown() { - return $this->isAlwaysKnown() || $this->exists(); + $isKnown = null; + + /** + * Allows overriding default behaviour for determining if a page exists. + * If $isKnown is kept as null, regular checks happen. If it's + * a boolean, this value is returned by the isKnown method. + * + * @since 1.19 + * + * @param Title $title + * @param boolean|null $isKnown + */ + wfRunHooks( 'TitleIsKnown', array( $this, &$isKnown ) ); + + return is_null( $isKnown ) ? ( $this->isAlwaysKnown() || $this->exists() ) : $isKnown; } /** -- 2.20.1