From c62449caaff1fd946d7f8d20cf78125f25f973b5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 24 Feb 2017 19:12:51 -0700 Subject: [PATCH] Extension.download API - Allow downloading without installing The current `download` action does both download and install. This option preserves the default behavior but allows one to opt-out of installation. --- api/v3/Extension.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/v3/Extension.php b/api/v3/Extension.php index 3862ac0cec..367ad7b66d 100644 --- a/api/v3/Extension.php +++ b/api/v3/Extension.php @@ -244,7 +244,9 @@ function civicrm_api3_extension_download($params) { } CRM_Extension_System::singleton()->getCache()->flush(); CRM_Extension_System::singleton(TRUE); - CRM_Extension_System::singleton()->getManager()->install(array($params['key'])); + if (CRM_Utils_Array::value('install', $params, TRUE)) { + CRM_Extension_System::singleton()->getManager()->install(array($params['key'])); + } return civicrm_api3_create_success(); } @@ -265,6 +267,12 @@ function _civicrm_api3_extension_download_spec(&$fields) { 'type' => CRM_Utils_Type::T_STRING, 'description' => 'Optional as the system can determine the url automatically for public extensions', ); + $fields['install'] = array( + 'title' => 'Auto-install', + 'type' => CRM_Utils_Type::T_STRING, + 'description' => 'Automatically install the downloaded extension', + 'api.default' => TRUE, + ); } /** -- 2.25.1