3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This class stores logic for managing CiviCRM extensions.
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 class CRM_Extension_Manager_Module
extends CRM_Extension_Manager_Base
{
21 * @param CRM_Extension_Mapper $mapper
23 public function __construct(CRM_Extension_Mapper
$mapper) {
24 parent
::__construct(FALSE);
25 $this->mapper
= $mapper;
29 * @param CRM_Extension_Info $info
31 public function onPreInstall(CRM_Extension_Info
$info) {
32 $this->callHook($info, 'install');
33 $this->callHook($info, 'enable');
37 * @param CRM_Extension_Info $info
39 public function onPostPostInstall(CRM_Extension_Info
$info) {
40 $this->callHook($info, 'postInstall');
44 * @param CRM_Extension_Info $info
45 * @param string $hookName
47 private function callHook(CRM_Extension_Info
$info, $hookName) {
49 $file = $this->mapper
->keyToPath($info->key
);
51 catch (CRM_Extension_Exception
$e) {
54 if (!file_exists($file)) {
58 $fnName = "{$info->file}_civicrm_{$hookName}";
59 if (function_exists($fnName)) {
65 * @param CRM_Extension_Info $info
69 public function onPreUninstall(CRM_Extension_Info
$info) {
70 $this->callHook($info, 'uninstall');
75 * @param CRM_Extension_Info $info
77 public function onPostUninstall(CRM_Extension_Info
$info) {
81 * @param CRM_Extension_Info $info
83 public function onPreDisable(CRM_Extension_Info
$info) {
84 $this->callHook($info, 'disable');
88 * @param CRM_Extension_Info $info
90 public function onPreEnable(CRM_Extension_Info
$info) {
91 $this->callHook($info, 'enable');