Anomie has uploaded a new change for review.

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

Change subject: API: Avoid caching when prop=info&intestactions=... is used
......................................................................

API: Avoid caching when prop=info&intestactions=... is used

Whether the actions pass or not depends on the current user, including
the results of several hooks and whether the current user is blocked.

Also, we can clean up the test for public inprops slightly.

Change-Id: I7e2610dd609c52711355b640778f795520a4ff8c
---
M includes/api/ApiQueryInfo.php
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/223047/1

diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index eee5dae..c45e0ef 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -799,6 +799,7 @@
        }
 
        public function getCacheMode( $params ) {
+               // Other props depend on something about the current user
                $publicProps = array(
                        'protection',
                        'talkid',
@@ -807,13 +808,15 @@
                        'preload',
                        'displaytitle',
                );
-               if ( !is_null( $params['prop'] ) ) {
-                       foreach ( $params['prop'] as $prop ) {
-                               if ( !in_array( $prop, $publicProps ) ) {
-                                       return 'private';
-                               }
-                       }
+               if ( array_diff( (array)$params['prop'], $publicProps ) ) {
+                       return 'private';
                }
+
+               // testactions also depends on the current user
+               if ( $params['testactions'] ) {
+                       return 'private';
+               }
+
                if ( !is_null( $params['token'] ) ) {
                        return 'private';
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e2610dd609c52711355b640778f795520a4ff8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to