forked from yakamara/redaxo_xform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.inc.php
66 lines (53 loc) · 1.23 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
<?php
/**
* XForm
* @author jan.kristinus[at]redaxo[dot]de Jan Kristinus
* @author <a href="http://www.yakamara.de">www.yakamara.de</a>
*/
$addonname = 'xform';
$msg = '';
// 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;
}
}
?>