forked from glFusion/lglib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoinstall.php
118 lines (100 loc) · 3.34 KB
/
autoinstall.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* Provides automatic installation of the lgLib plugin.
* There is nothing to do except create the plugin record
* since there are no tables or user interfaces.
*
* @author Lee Garner <lee@leegarner.com>
* @copyright Copyright (c) 2012 Lee Garner <lee@leegarner.com>
* @package lglib
* @version 0.0.1
* @license http://opensource.org/licenses/gpl-2.0.php
* GNU Public License v2 or later
* @filesource
*/
if (!defined ('GVERSION')) {
die ('This file can not be used on its own.');
}
/** @global string $_DB_dbms */
global $_DB_dbms;
require_once dirname(__FILE__) . '/functions.inc';
require_once dirname(__FILE__) . '/lglib.php';
require_once LGLIB_PI_PATH . "/sql/{$_DB_dbms}_install.php";
// Plugin installation options
$INSTALL_plugin[$_LGLIB_CONF['pi_name']] = array(
'installer' => array('type' => 'installer',
'version' => '1',
'mode' => 'install'),
'plugin' => array('type' => 'plugin',
'name' => $_LGLIB_CONF['pi_name'],
'ver' => $_LGLIB_CONF['pi_version'],
'gl_ver' => $_LGLIB_CONF['gl_version'],
'url' => $_LGLIB_CONF['pi_url'],
'display' => $_LGLIB_CONF['pi_display_name']
),
array('type' => 'mkdir',
'dirs' => array($_CONF['path'] . 'data/' .
$_LGLIB_CONF['pi_name'],
$_CONF['path'] . 'data/' .
$_LGLIB_CONF['pi_name'] . '/cache',
),
),
array('type' => 'table',
'table' => $_TABLES['lglib_messages'],
'sql' => $_SQL['lglib_messages']),
array('type' => 'table',
'table' => $_TABLES['lglib_jobqueue'],
'sql' => $_SQL['lglib_jobqueue']),
);
/**
* Puts the datastructures for this plugin into the glFusion database
* Note: Corresponding uninstall routine is in functions.inc
*
* @return boolean True if successful False otherwise
*/
function plugin_install_lglib()
{
global $INSTALL_plugin, $_LGLIB_CONF;
COM_errorLog("Attempting to install the {$_LGLIB_CONF['pi_name']} plugin", 1);
$ret = INSTALLER_install($INSTALL_plugin[$_LGLIB_CONF['pi_name']]);
if ($ret > 0) {
return false;
} else {
return true;
}
}
/**
* Automatic removal function.
*
* @return array Array of items to be removed.
*/
function plugin_autouninstall_lglib()
{
global $_LGLIB_CONF;
$out = array (
'tables' => array('lglib_messages', 'lglib_jobqueue'),
'groups' => array(),
'features' => array(),
'php_blocks' => array(),
'vars' => array(
$_LGLIB_CONF['pi_name'] . '_dbback_exclude',
$_LGLIB_CONF['pi_name'] . '_dbback_sendto',
$_LGLIB_CONF['pi_name'] . '_dbback_files',
$_LGLIB_CONF['pi_name'] . '_dbback_cron',
$_LGLIB_CONF['pi_name'] . '_dbback_gzip',
$_LGLIB_CONF['pi_name'] . '_dbback_lastrun',
),
);
return $out;
}
/**
* Loads the configuration records for the Online Config Manager.
*
* @return boolean True = proceed, False = an error occured
*/
function plugin_load_configuration_lglib()
{
require_once dirname(__FILE__) . '/install_defaults.php';
return plugin_initconfig_lglib();
}
?>