Merge pull request #11657 from eileenmcnaughton/more_speed
[civicrm-core.git] / CRM / Extension / Manager / Base.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
7e9e8871 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 * The extension manager handles installing, disabling enabling, and
30 * uninstalling extensions.
31 *
32 * @package CRM
8c9251b3 33 * @copyright CiviCRM LLC (c) 2004-2018
6a488035
TO
34 */
35class CRM_Extension_Manager_Base implements CRM_Extension_Manager_Interface {
36
37 /**
38 * @var bool hether to automatically uninstall and install during 'replace'
39 */
40 public $autoReplace;
41
42 /**
f41911fd
TO
43 * @param bool $autoReplace
44 * Whether to automatically uninstall and install during 'replace'.
6a488035
TO
45 */
46 public function __construct($autoReplace = FALSE) {
47 $this->autoReplace = $autoReplace;
48 }
49
50 /**
e7c15cb6 51 * @inheritDoc
4faa436b
SB
52 *
53 * @param CRM_Extension_Info $info
6a488035
TO
54 */
55 public function onPreInstall(CRM_Extension_Info $info) {
56 }
57
58 /**
e7c15cb6 59 * @inheritDoc
4faa436b
SB
60 *
61 * @param CRM_Extension_Info $info
6a488035
TO
62 */
63 public function onPostInstall(CRM_Extension_Info $info) {
64 }
65
2d7fd075 66 /**
e7c15cb6 67 * @inheritDoc
4faa436b
SB
68 *
69 * @param CRM_Extension_Info $info
2d7fd075
TO
70 */
71 public function onPostPostInstall(CRM_Extension_Info $info) {
72 }
73
6a488035 74 /**
e7c15cb6 75 * @inheritDoc
4faa436b
SB
76 *
77 * @param CRM_Extension_Info $info
6a488035
TO
78 */
79 public function onPreEnable(CRM_Extension_Info $info) {
80 }
81
82 /**
e7c15cb6 83 * @inheritDoc
4faa436b
SB
84 *
85 * @param CRM_Extension_Info $info
6a488035
TO
86 */
87 public function onPostEnable(CRM_Extension_Info $info) {
88 }
89
90 /**
e7c15cb6 91 * @inheritDoc
4faa436b
SB
92 *
93 * @param CRM_Extension_Info $info
6a488035
TO
94 */
95 public function onPreDisable(CRM_Extension_Info $info) {
96 }
97
98 /**
e7c15cb6 99 * @inheritDoc
4faa436b
SB
100 *
101 * @param CRM_Extension_Info $info
6a488035
TO
102 */
103 public function onPostDisable(CRM_Extension_Info $info) {
104 }
105
106 /**
e7c15cb6 107 * @inheritDoc
4faa436b
SB
108 *
109 * @param CRM_Extension_Info $info
6a488035
TO
110 */
111 public function onPreUninstall(CRM_Extension_Info $info) {
112 }
113
114 /**
e7c15cb6 115 * @inheritDoc
4faa436b
SB
116 *
117 * @param CRM_Extension_Info $info
6a488035
TO
118 */
119 public function onPostUninstall(CRM_Extension_Info $info) {
120 }
121
122 /**
e7c15cb6 123 * @inheritDoc
4faa436b
SB
124 *
125 * @param CRM_Extension_Info $oldInfo
126 * @param CRM_Extension_Info $newInfo
6a488035
TO
127 */
128 public function onPreReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
129 if ($this->autoReplace) {
130 $this->onPreUninstall($oldInfo);
131 $this->onPostUninstall($oldInfo);
132 }
133 }
134
135 /**
e7c15cb6 136 * @inheritDoc
4faa436b
SB
137 *
138 * @param CRM_Extension_Info $oldInfo
139 * @param CRM_Extension_Info $newInfo
6a488035
TO
140 */
141 public function onPostReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
142 if ($this->autoReplace) {
143 $this->onPreInstall($oldInfo);
144 $this->onPostInstall($oldInfo);
145 }
146 }
96025800 147
6a488035 148}