Merge pull request #17963 from civicrm/5.28
[civicrm-core.git] / CRM / Extension / Manager / Base.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 * The extension manager handles installing, disabling enabling, and
14 * uninstalling extensions.
15 *
16 * @package CRM
ca5cec67 17 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
18 */
19class CRM_Extension_Manager_Base implements CRM_Extension_Manager_Interface {
20
21 /**
041ecc95 22 * Whether to automatically uninstall and install during 'replace'.
23 *
24 * @var bool
6a488035
TO
25 */
26 public $autoReplace;
27
28 /**
f41911fd
TO
29 * @param bool $autoReplace
30 * Whether to automatically uninstall and install during 'replace'.
6a488035
TO
31 */
32 public function __construct($autoReplace = FALSE) {
33 $this->autoReplace = $autoReplace;
34 }
35
36 /**
e7c15cb6 37 * @inheritDoc
4faa436b
SB
38 *
39 * @param CRM_Extension_Info $info
6a488035
TO
40 */
41 public function onPreInstall(CRM_Extension_Info $info) {
42 }
43
44 /**
e7c15cb6 45 * @inheritDoc
4faa436b
SB
46 *
47 * @param CRM_Extension_Info $info
6a488035
TO
48 */
49 public function onPostInstall(CRM_Extension_Info $info) {
50 }
51
2d7fd075 52 /**
e7c15cb6 53 * @inheritDoc
4faa436b
SB
54 *
55 * @param CRM_Extension_Info $info
2d7fd075
TO
56 */
57 public function onPostPostInstall(CRM_Extension_Info $info) {
58 }
59
6a488035 60 /**
e7c15cb6 61 * @inheritDoc
4faa436b
SB
62 *
63 * @param CRM_Extension_Info $info
6a488035
TO
64 */
65 public function onPreEnable(CRM_Extension_Info $info) {
66 }
67
68 /**
e7c15cb6 69 * @inheritDoc
4faa436b
SB
70 *
71 * @param CRM_Extension_Info $info
6a488035
TO
72 */
73 public function onPostEnable(CRM_Extension_Info $info) {
74 }
75
76 /**
e7c15cb6 77 * @inheritDoc
4faa436b
SB
78 *
79 * @param CRM_Extension_Info $info
6a488035
TO
80 */
81 public function onPreDisable(CRM_Extension_Info $info) {
82 }
83
84 /**
e7c15cb6 85 * @inheritDoc
4faa436b
SB
86 *
87 * @param CRM_Extension_Info $info
6a488035
TO
88 */
89 public function onPostDisable(CRM_Extension_Info $info) {
90 }
91
92 /**
e7c15cb6 93 * @inheritDoc
4faa436b
SB
94 *
95 * @param CRM_Extension_Info $info
6a488035
TO
96 */
97 public function onPreUninstall(CRM_Extension_Info $info) {
98 }
99
100 /**
e7c15cb6 101 * @inheritDoc
4faa436b
SB
102 *
103 * @param CRM_Extension_Info $info
6a488035
TO
104 */
105 public function onPostUninstall(CRM_Extension_Info $info) {
106 }
107
108 /**
e7c15cb6 109 * @inheritDoc
4faa436b
SB
110 *
111 * @param CRM_Extension_Info $oldInfo
112 * @param CRM_Extension_Info $newInfo
6a488035
TO
113 */
114 public function onPreReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
115 if ($this->autoReplace) {
116 $this->onPreUninstall($oldInfo);
117 $this->onPostUninstall($oldInfo);
118 }
119 }
120
121 /**
e7c15cb6 122 * @inheritDoc
4faa436b
SB
123 *
124 * @param CRM_Extension_Info $oldInfo
125 * @param CRM_Extension_Info $newInfo
6a488035
TO
126 */
127 public function onPostReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
128 if ($this->autoReplace) {
129 $this->onPreInstall($oldInfo);
130 $this->onPostInstall($oldInfo);
131 }
132 }
96025800 133
6a488035 134}