From: Brad Jorsch Date: Mon, 6 Jul 2015 16:07:45 +0000 (-0400) Subject: API: Avoid caching when prop=info&intestactions=... is used X-Git-Tag: 1.31.0-rc.0~10874^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=2445aeed7a3d5919449582b8f2d82aaa73fd363a;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index eee5daef65..c45e0ef7c6 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -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'; }