This repository has been archived by the owner on Dec 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathinstall.inc.php
74 lines (55 loc) · 1.96 KB
/
install.inc.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
<?php
/**
* XForm
* @author jan.kristinus[at]redaxo[dot]org Jan Kristinus
* @author <a href="http://www.yakamara.de">www.yakamara.de</a>
*/
$addonname = 'xform';
$I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/xform/lang/');
$msg = '';
if ($REX['VERSION'] != '4' || $REX['SUBVERSION'] < '5') {
$msg = $I18N->msg('xform_install_redaxo_version_problem', '4.5');
} elseif (version_compare(PHP_VERSION, '5.3.0', '<')) {
$msg = $I18N->msg('xform_install_checkphpversion', PHP_VERSION);
} elseif (OOAddon::isAvailable('phpmailer') != 1 || OOAddon::getVersion('phpmailer') < '2.8') {
$msg = $I18N->msg('xform_install_phpmailer_version_problem', '2.8');
} else {
include_once rex_path::addon('xform', 'classes/basic/class.rex_xform.inc.php');
// AUTOINSTALL THESE PLUGINS
$autoinstall = array('email', 'setup', 'manager');
// GET ALL ADDONS & PLUGINS
$all_addons = rex_read_addons_folder();
$all_plugins = array();
foreach ($all_addons as $_addon) {
$all_plugins[$_addon] = rex_read_plugins_folder($_addon);
}
// DO AUTOINSTALL
$pluginManager = new rex_pluginManager($all_plugins, $addonname);
foreach ($autoinstall as $pluginname) {
// INSTALL PLUGIN
if (($instErr = $pluginManager->install($pluginname)) !== true) {
$msg = $instErr;
}
// ACTIVATE PLUGIN
if ($msg == '' && ($actErr = $pluginManager->activate($pluginname)) !== true) {
$msg = $actErr;
}
if ($msg != '') {
break;
}
}
}
if ($msg != '') {
$REX['ADDON']['installmsg'][$addonname] = $msg;
} else {
// INSTALL ADDON
$sql = rex_sql::factory();
if ($sql->hasError()) {
$msg = 'MySQL-Error: ' . $sql->getErrno() . '<br />';
$msg .= $sql->getError();
$REX['ADDON']['install'][$addonname] = 0;
$REX['ADDON']['installmsg'][$addonname] = $msg;
} else {
$REX['ADDON']['install'][$addonname] = 1;
}
}