-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnodejs_setup.php
More file actions
99 lines (78 loc) · 1.55 KB
/
nodejs_setup.php
File metadata and controls
99 lines (78 loc) · 1.55 KB
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
<?php
/**
* @file
* Installation hooks and callbacks of nodejs plugin.
*/
if(!defined('e107_INIT'))
{
exit;
}
/**
* Class nodejs_setup.
*/
class nodejs_setup
{
/**
* This function is called before plugin table has been created
* by the nodejs_sql.php file.
*
* @param array $var
*/
function install_pre($var)
{
}
/**
* This function is called after plugin table has been created
* by the nodejs_sql.php file.
*
* @param array $var
*/
function install_post($var)
{
// Scan plugin directories to check e_nodejs.php files.
$fl = e107::getFile();
$plugList = $fl->get_files(e_PLUGIN, "^plugin\.(php|xml)$", "standard", 1);
$pluginList = array();
$addonsList = array();
// Remove Duplicates caused by having both plugin.php AND plugin.xml.
foreach($plugList as $num => $val)
{
$key = basename($val['path']);
$pluginList[$key] = $val;
}
foreach($pluginList as $p)
{
$p['path'] = substr(str_replace(e_PLUGIN, '', $p['path']), 0, -1);
$plugin_path = $p['path'];
if(is_readable(e_PLUGIN . $plugin_path . '/e_nodejs.php'))
{
$addonsList[] = $plugin_path;
}
}
e107::getPlugConfig('nodejs')->set('nodejs_addon_list', $addonsList)->save();
}
function uninstall_options()
{
}
function uninstall_post($var)
{
}
/**
* Trigger an upgrade alert or not.
*
* @param array $var
*
* @return bool
* True to trigger an upgrade alert, and false to not.
*/
function upgrade_required($var)
{
return false;
}
function upgrade_pre($var)
{
}
function upgrade_post($var)
{
}
}