Add TitleExists hook
authorJackmcbarn <jackmcbarn@gmail.com>
Mon, 15 Sep 2014 22:46:25 +0000 (18:46 -0400)
committerJackmcbarn <jackmcbarn@gmail.com>
Mon, 15 Sep 2014 22:46:25 +0000 (18:46 -0400)
Bug: 70495
Change-Id: I4f9a04d09ff8c4bdda678a591aea7f1153cb0a40

docs/hooks.txt
includes/Title.php

index 9ac2271..5be770e 100644 (file)
@@ -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
index 7959860..8ffea35 100644 (file)
@@ -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;
        }
 
        /**