Repository navigation
Expand file tree
/
Copy pathinstall_defaults.php
More file actions
60 lines (52 loc) · 2.54 KB
/
Copy pathinstall_defaults.php
File metadata and controls
60 lines (52 loc) · 2.54 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
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Maintenance Plugin 1.1.1 |
// +---------------------------------------------------------------------------+
// | install_defaults.php |
// +---------------------------------------------------------------------------+
// Prevent this file from being accessed directly
if (isset($_SERVER['PHP_SELF']) &&
strpos(strtolower($_SERVER['PHP_SELF']), 'install_defaults.php') !== false) {
die('This file cannot be used on its own!');
}
/*
* Maintenance default settings
*
* Initial Installation Defaults used when loading the online configuration
* records. These settings are only used during the initial installation
* and are not referenced anymore once the plugin is installed.
*/
global $_MAINTENANCE_DEFAULT;
$_MAINTENANCE_DEFAULT = array();
$_MAINTENANCE_DEFAULT['enabled'] = 0;
$_MAINTENANCE_DEFAULT['message'] = 'The website is currently under maintenance. Please come back later.';
$_MAINTENANCE_DEFAULT['retry_after'] = 3600;
/**
* Initialize Maintenance plugin configuration.
*
* @return bool True if the configuration is initialized, false otherwise.
*/
function plugin_initconfig_maintenance()
{
global $_MAINTENANCE_DEFAULT, $_TABLES;
$c = config::get_instance();
if (!$c->group_exists('maintenance')) {
$c->add('sg_0', NULL, 'subgroup', 0, 0, NULL, 0, true, 'maintenance');
$c->add('tab_main', NULL, 'tab', 0, 0, NULL, 0, true, 'maintenance', 0);
$c->add('fs_01', NULL, 'fieldset', 0, 0, NULL, 0, true, 'maintenance', 0);
$c->add('enabled', $_MAINTENANCE_DEFAULT['enabled'], 'select', 0, 0, 0, 10, true, 'maintenance', 0);
$c->add('message', $_MAINTENANCE_DEFAULT['message'], 'text', 0, 0, 0, 20, true, 'maintenance', 0);
$c->add('retry_after', $_MAINTENANCE_DEFAULT['retry_after'], 'select', 0, 0, 2, 30, true, 'maintenance', 0);
} else {
if (DB_count($_TABLES['conf_values'], array('name', 'group_name'),
array('tab_main', 'maintenance')) == 0) {
$c->add('tab_main', NULL, 'tab', 0, 0, NULL, 0, true, 'maintenance', 0);
}
if (DB_count($_TABLES['conf_values'], array('name', 'group_name'),
array('retry_after', 'maintenance')) == 0) {
$c->add('retry_after', $_MAINTENANCE_DEFAULT['retry_after'], 'select', 0, 0, 2, 30, true, 'maintenance', 0);
}
}
return true;
}