-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.php
More file actions
55 lines (49 loc) · 1.77 KB
/
Copy pathinstall.php
File metadata and controls
55 lines (49 loc) · 1.77 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
<?php
/**
* GaugeSupport - a MantisBT plugin allowing users to vote on issues.
*
* Copyright (c) 2010 Charly Kiendl
* Copyright (c) 2017 Cas Nuy
* Copyright (c) 2019 Damien Regad
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Install UpdateFunction to convert config names.
*
* Config option names were changed in 2.5.0. For each old config,
* set the new one to the old's value and delete the old.
*
* @return int 2 if success
* @noinspection PhpUnused
*/
function install_convert_config_names() {
$t_config_map = array(
'gaugesupport_excl_status' => 'excl_status',
'gaugesupport_excl_resolution' => 'excl_resolution',
'gaugesupport_incl_severity' => 'incl_severity',
);
# Get config default values
$t_gaugesupport_plugin = new GaugeSupportPlugin( plugin_get_current() );
$t_default_values = $t_gaugesupport_plugin->config();
foreach( $t_config_map as $t_old => $t_new ) {
$t_value = plugin_config_get( $t_old, '' );
# Set the new value if different from default
if( $t_value && isset( $t_default_values[$t_new] ) && $t_value != $t_default_values[$t_new] ) {
plugin_config_set( $t_new, $t_value );
}
plugin_config_delete( $t_old );
}
return 2;
}