Merge "API: Avoid caching when prop=info&intestactions=... is used"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 6 Jul 2015 20:17:39 +0000 (20:17 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 6 Jul 2015 20:17:39 +0000 (20:17 +0000)
includes/api/ApiQueryInfo.php

index eee5dae..c45e0ef 100644 (file)
@@ -799,6 +799,7 @@ class ApiQueryInfo extends ApiQueryBase {
        }
 
        public function getCacheMode( $params ) {
+               // Other props depend on something about the current user
                $publicProps = array(
                        'protection',
                        'talkid',
@@ -807,13 +808,15 @@ class ApiQueryInfo extends ApiQueryBase {
                        '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';
                }