Merge pull request #2324 from yashodha/4.4
[civicrm-core.git] / CRM / Extension / Manager / Base.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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
33 * @copyright CiviCRM LLC (c) 2004-2013
34 * $Id$
35 *
36 */
37class 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 /**
45 * @param bool $autoReplace whether to automatically uninstall and install during 'replace'
46 */
47 public function __construct($autoReplace = FALSE) {
48 $this->autoReplace = $autoReplace;
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function onPreInstall(CRM_Extension_Info $info) {
55 }
56
57 /**
58 * {@inheritdoc}
59 */
60 public function onPostInstall(CRM_Extension_Info $info) {
61 }
62
2d7fd075
TO
63 /**
64 * {@inheritdoc}
65 */
66 public function onPostPostInstall(CRM_Extension_Info $info) {
67 }
68
6a488035
TO
69 /**
70 * {@inheritdoc}
71 */
72 public function onPreEnable(CRM_Extension_Info $info) {
73 }
74
75 /**
76 * {@inheritdoc}
77 */
78 public function onPostEnable(CRM_Extension_Info $info) {
79 }
80
81 /**
82 * {@inheritdoc}
83 */
84 public function onPreDisable(CRM_Extension_Info $info) {
85 }
86
87 /**
88 * {@inheritdoc}
89 */
90 public function onPostDisable(CRM_Extension_Info $info) {
91 }
92
93 /**
94 * {@inheritdoc}
95 */
96 public function onPreUninstall(CRM_Extension_Info $info) {
97 }
98
99 /**
100 * {@inheritdoc}
101 */
102 public function onPostUninstall(CRM_Extension_Info $info) {
103 }
104
105 /**
106 * {@inheritdoc}
107 */
108 public function onPreReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
109 if ($this->autoReplace) {
110 $this->onPreUninstall($oldInfo);
111 $this->onPostUninstall($oldInfo);
112 }
113 }
114
115 /**
116 * {@inheritdoc}
117 */
118 public function onPostReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) {
119 if ($this->autoReplace) {
120 $this->onPreInstall($oldInfo);
121 $this->onPostInstall($oldInfo);
122 }
123 }
124}