-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.php
94 lines (79 loc) · 2.72 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/*
* CiviAuthenticate installation routine
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Script file of CiviCRM plugin
*/
class plgauthenticationcivicrmInstallerScript {
/**
* method to install the plugin
*
* @return void
*/
function install($parent) {
// $parent is the class calling this method
}
/**
* method to uninstall the plugin
*
* @return void
*/
function uninstall($parent) {
// $parent is the class calling this method
echo '<p>' . JText::_('PLG_CIVICRM_UNINSTALL_TEXT') . '</p>';
$filename = 'civimembershiplevels.php';
$path = JPATH_SITE . '/administrator/components/com_civicrm/civicrm/joomla/site/elements';
echo '<p>Removing file from: ' . $path . '/' . $filename . '</p>';
JFile::delete($path . '/' . $filename);
$filename = 'civimembershiptypes.php';
echo '<p>Removing file from: ' . $path . '/' . $filename . '</p>';
JFile::delete($path . '/' . $filename);
echo '<p>Important! Failure to enable an authentication module will likely result in your being locked out of your site!</p>';
}
/**
* method to update the plugin
*
* @return void
*/
function update($parent) {
// $parent is the class calling this method
// echo '<p>' . JText::_('PLG_CIVICRM_UPDATE_TEXT') . '</p>';
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
function preflight($type, $parent) {
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent) {
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
// File move is in post flight as we have to wait on the installer having installed it first.
//
if (in_array($type, array("install", "update"))) {
$path1 = JPATH_SITE . '/plugins/authentication/civicrm/fields';
$path2 = JPATH_SITE . '/administrator/components/com_civicrm/civicrm/joomla/site/elements';
foreach (array('civimembershiplevels.php', 'civimembershiptypes.php') as $filename) {
$from = $path1 . '/' . $filename;
$to = $path2 . '/' . $filename;
echo '<p>Move from: ' . $from . '</p>';
echo '<p>To: ' . $to . '</p>';
JFile::copy($from, $to);
}
echo '<p>' . JText::_('Done dealing with files injected into CiviCRM ') . '</p>';
echo '<p>' . JText::_('PLG_CIVICRM_POSTFLIGHT_' . strtoupper($type) . '_TEXT') . '</p>';
}
}
}