+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* This class handles downloads of remotely-provided extensions
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Extension_Downloader {
/**
/**
* Determine whether downloading is supported.
*
+ * @param \CRM_EXtension_Info $extensionInfo Optional info for (updated) extension
+ *
* @return array
* list of error messages; empty if OK
*/
- public function checkRequirements() {
+ public function checkRequirements($extensionInfo = NULL) {
$errors = array();
if (!$this->containerDir || !is_dir($this->containerDir) || !is_writable($this->containerDir)) {
CRM_Core_Error::debug_log_message('WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP\'s open_basedir or safe_mode.');
}
+ if ($extensionInfo) {
+ $requiredExtensions = CRM_Extension_System::singleton()->getManager()->findInstallRequirements([$extensionInfo->key], $extensionInfo);
+ foreach ($requiredExtensions as $extension) {
+ if (CRM_Extension_System::singleton()->getManager()->getStatus($extension) !== CRM_Extension_Manager::STATUS_INSTALLED && $extension !== $extensionInfo->key) {
+ $errors[] = [
+ 'title' => ts('Missing Requirement: %1', [1 => $extension]),
+ 'message' => ts('You will not be able to install/upgrade %1 until you have installed the %2 extension.', [1 => $extensionInfo->key, 2 => $extension]),
+ ];
+ }
+ }
+ }
+
return $errors;
}