From: Tyler Anthony Romeo Date: Fri, 8 Mar 2013 20:15:27 +0000 (-0500) Subject: Add TitleQuickPermissions hook to Title::checkQuickPermissions X-Git-Tag: 1.31.0-rc.0~19546^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=7120504bb99d39809787c461b711a7ee506165d6;p=lhc%2Fweb%2Fwiklou.git Add TitleQuickPermissions hook to Title::checkQuickPermissions Currently Title permissions hooks get called after Title::checkQuickPermissions, preventing users from overriding quick permission checks. Added a hook to allow this. Needed for bug 45898. Change-Id: Id672270741282778815b06eff8b234ca4d819744 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index a6fa9fed76..f128efd1ac 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2332,6 +2332,15 @@ database result. &$titleArray: set this to an object to override the default object returned $res: database result used to create the object +'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to +or override the quick permissions check. +$title: The Title object being accessed +$user: The User performing the action +$action: Action being performed +&$errors: Array of errors +$doExpensiveQueries: Whether to do expensive DB queries +$short: Whether to return immediately on first error + 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection that can be applied. $title: The title in question. diff --git a/includes/Title.php b/includes/Title.php index 66a6ce5c52..29e810e62a 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1739,6 +1739,10 @@ class Title { * @return Array list of errors */ private function checkQuickPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) { + if ( !wfRunHooks( 'TitleQuickPermissions', array( $this, $user, $action, &$errors, $doExpensiveQueries, $short ) ) ) { + return $errors; + } + if ( $action == 'create' ) { if ( ( $this->isTalkPage() && !$user->isAllowed( 'createtalk' ) ) ||