From c5bf60d572c9ed167fb86d642d60cce7688bed26 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Thu, 6 Jul 2017 16:07:39 +0530 Subject: [PATCH] modify fix to place cache dir in upload dir --- CRM/Extension/System.php | 24 +++--------------------- tools/extensions/.gitignore | 1 - 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php index c8ea7e1274..d83263a579 100644 --- a/CRM/Extension/System.php +++ b/CRM/Extension/System.php @@ -98,6 +98,7 @@ class CRM_Extension_System { $parameters['extensionsDir'] = CRM_Utils_Array::value('extensionsDir', $parameters, $config->extensionsDir); $parameters['extensionsURL'] = CRM_Utils_Array::value('extensionsURL', $parameters, $config->extensionsURL); $parameters['resourceBase'] = CRM_Utils_Array::value('resourceBase', $parameters, $config->resourceBase); + $parameters['uploadDir'] = CRM_Utils_Array::value('uploadDir', $parameters, $config->uploadDir); $parameters['userFrameworkBaseURL'] = CRM_Utils_Array::value('userFrameworkBaseURL', $parameters, $config->userFrameworkBaseURL); if (!array_key_exists('civicrm_root', $parameters)) { $parameters['civicrm_root'] = $GLOBALS['civicrm_root']; @@ -223,33 +224,14 @@ class CRM_Extension_System { public function getBrowser() { if ($this->browser === NULL) { $cacheDir = NULL; - if ($this->getDefaultContainer()) { - $cacheDir = $this->getDefaultContainer()->getBaseDir() . DIRECTORY_SEPARATOR . 'cache'; - $this->createGitIgnoreForCacheFiles($this->getDefaultContainer()->getBaseDir()); + if (!empty($this->parameters['uploadDir'])) { + $cacheDir = CRM_Utils_File::addTrailingSlash($this->parameters['uploadDir']) . 'cache'; } $this->browser = new CRM_Extension_Browser($this->getRepositoryUrl(), '', $cacheDir); } return $this->browser; } - /** - * Create .gitignore to remove cache dir. - * - * @param string $extPath - */ - public function createGitIgnoreForCacheFiles($extPath) { - if (!empty($extPath)) { - $path = $extPath . DIRECTORY_SEPARATOR . '.gitignore'; - if (file_exists($path)) { - //Return if cache dir is already ignored. - if (in_array('cache', explode("\n", file_get_contents($path)))) { - return; - } - } - file_put_contents($path, "cache\n", FILE_APPEND); - } - } - /** * Get the service for loading code from remotely-available extensions * diff --git a/tools/extensions/.gitignore b/tools/extensions/.gitignore index 8ca96b7556..05d4332dde 100644 --- a/tools/extensions/.gitignore +++ b/tools/extensions/.gitignore @@ -3,4 +3,3 @@ civisualize civivolunteer org.civicoop.civirules org.civicrm.angularprofiles -cache -- 2.25.1