Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * The extension manager handles installing, disabling enabling, and | |
30 | * uninstalling extensions. | |
31 | * | |
32 | * @package CRM | |
06b69b18 | 33 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
34 | * $Id$ |
35 | * | |
36 | */ | |
37 | class CRM_Extension_Manager_Base implements CRM_Extension_Manager_Interface { | |
38 | ||
39 | /** | |
40 | * @var bool hether to automatically uninstall and install during 'replace' | |
41 | */ | |
42 | public $autoReplace; | |
43 | ||
44 | /** | |
f41911fd TO |
45 | * @param bool $autoReplace |
46 | * Whether to automatically uninstall and install during 'replace'. | |
6a488035 TO |
47 | */ |
48 | public function __construct($autoReplace = FALSE) { | |
49 | $this->autoReplace = $autoReplace; | |
50 | } | |
51 | ||
52 | /** | |
e7c15cb6 | 53 | * @inheritDoc |
6a488035 TO |
54 | */ |
55 | public function onPreInstall(CRM_Extension_Info $info) { | |
56 | } | |
57 | ||
58 | /** | |
e7c15cb6 | 59 | * @inheritDoc |
6a488035 TO |
60 | */ |
61 | public function onPostInstall(CRM_Extension_Info $info) { | |
62 | } | |
63 | ||
2d7fd075 | 64 | /** |
e7c15cb6 | 65 | * @inheritDoc |
2d7fd075 TO |
66 | */ |
67 | public function onPostPostInstall(CRM_Extension_Info $info) { | |
68 | } | |
69 | ||
6a488035 | 70 | /** |
e7c15cb6 | 71 | * @inheritDoc |
6a488035 TO |
72 | */ |
73 | public function onPreEnable(CRM_Extension_Info $info) { | |
74 | } | |
75 | ||
76 | /** | |
e7c15cb6 | 77 | * @inheritDoc |
6a488035 TO |
78 | */ |
79 | public function onPostEnable(CRM_Extension_Info $info) { | |
80 | } | |
81 | ||
82 | /** | |
e7c15cb6 | 83 | * @inheritDoc |
6a488035 TO |
84 | */ |
85 | public function onPreDisable(CRM_Extension_Info $info) { | |
86 | } | |
87 | ||
88 | /** | |
e7c15cb6 | 89 | * @inheritDoc |
6a488035 TO |
90 | */ |
91 | public function onPostDisable(CRM_Extension_Info $info) { | |
92 | } | |
93 | ||
94 | /** | |
e7c15cb6 | 95 | * @inheritDoc |
6a488035 TO |
96 | */ |
97 | public function onPreUninstall(CRM_Extension_Info $info) { | |
98 | } | |
99 | ||
100 | /** | |
e7c15cb6 | 101 | * @inheritDoc |
6a488035 TO |
102 | */ |
103 | public function onPostUninstall(CRM_Extension_Info $info) { | |
104 | } | |
105 | ||
106 | /** | |
e7c15cb6 | 107 | * @inheritDoc |
6a488035 TO |
108 | */ |
109 | public function onPreReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) { | |
110 | if ($this->autoReplace) { | |
111 | $this->onPreUninstall($oldInfo); | |
112 | $this->onPostUninstall($oldInfo); | |
113 | } | |
114 | } | |
115 | ||
116 | /** | |
e7c15cb6 | 117 | * @inheritDoc |
6a488035 TO |
118 | */ |
119 | public function onPostReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) { | |
120 | if ($this->autoReplace) { | |
121 | $this->onPreInstall($oldInfo); | |
122 | $this->onPostInstall($oldInfo); | |
123 | } | |
124 | } | |
125 | } |