Parent5446 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52910


Change subject: Added hook to override Title::checkQuickPermissions.
......................................................................

Added hook to override 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
---
M docs/hooks.txt
M includes/Title.php
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/52910/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index cd1af96..18487c5 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2281,6 +2281,13 @@
 &$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.
+$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 46b0524..281f9fb 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -1731,6 +1731,10 @@
         * @return Array list of errors
         */
        private function checkQuickPermissions( $action, $user, $errors, 
$doExpensiveQueries, $short ) {
+               if ( !wfRunHooks( 'TitleQuickPermissions', array( $action, 
&$errors, $doExpensiveQueries, $short ) ) ) {
+                       return $errors;
+               }
+
                if ( $action == 'create' ) {
                        if (
                                ( $this->isTalkPage() && !$user->isAllowed( 
'createtalk' ) ) ||

-- 
To view, visit https://gerrit.wikimedia.org/r/52910
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id672270741282778815b06eff8b234ca4d819744
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Parent5446 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to