1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Upgrader from to 2.4.0 alpha to 2.4.0 final |
14
|
|
|
* See the enclosed file license.txt for licensing information. |
15
|
|
|
* If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html |
16
|
|
|
* |
17
|
|
|
* @copyright The XOOPS project http://www.xoops.org/ |
18
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL) |
19
|
|
|
* @package upgrader |
20
|
|
|
* @since 2.4.0 |
21
|
|
|
* @author Taiwen Jiang <[email protected]> |
22
|
|
|
* @author trabis <[email protected]> |
23
|
|
|
* @version $Id$ |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
class upgrade_240a extends xoopsUpgrade |
27
|
|
|
{ |
28
|
|
|
public $tasks = array('config', 'configoption'); |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Check if cpanel config already exists |
32
|
|
|
|
33
|
|
|
*/ |
34
|
|
|
public function check_config() |
35
|
|
|
{ |
36
|
|
|
$xoops = Xoops::getInstance(); |
37
|
|
|
$db = $xoops->db(); |
38
|
|
|
$sql = "SELECT COUNT(*) FROM `" . $db->prefix('config') . "` WHERE `conf_name` IN ('systemkey', 'soap_xoops_username', 'soap_xoops_password', 'soap_soapclient', 'soap_wdsl', 'soap_keepclient', 'soap_filterperson', 'soap_proxyhost', 'soap_proxyport', 'soap_proxyusername', 'soap_proxypassword', 'soap_timeout', 'soap_responsetimeout', 'soap_fieldmapping', 'soap_provisionning', 'soap_provisionning_group')"; |
39
|
|
|
if (!$result = $db->queryF($sql)) { |
|
|
|
|
40
|
|
|
return false; |
41
|
|
|
} |
42
|
|
|
list($count) = $db->fetchRow($result); |
|
|
|
|
43
|
|
|
return ($count > 0) ? false : true; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function check_configoption() |
47
|
|
|
{ |
48
|
|
|
$xoops = Xoops::getInstance(); |
49
|
|
|
$db = $xoops->db(); |
50
|
|
|
$sql = "SELECT COUNT(*) FROM `" . $db->prefix('configoption') . "` WHERE `confop_name` IN ('_MD_AM_AUTH_CONFOPTION_SOAP')"; |
51
|
|
|
if (!$result = $db->queryF($sql)) { |
52
|
|
|
return false; |
53
|
|
|
} |
54
|
|
|
list($count) = $db->fetchRow($result); |
55
|
|
|
return ($count == 1) ? false : true; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function apply_config() |
59
|
|
|
{ |
60
|
|
|
$xoops = Xoops::getInstance(); |
61
|
|
|
$db = $xoops->db(); |
62
|
|
|
$configs = array( |
63
|
|
|
'systemkey', 'soap_xoops_username', 'soap_xoops_password', 'soap_soapclient', 'soap_wdsl', |
64
|
|
|
'soap_keepclient', 'soap_filterperson', 'soap_proxyhost', 'soap_proxyport', 'soap_proxyusername', |
65
|
|
|
'soap_proxypassword', 'soap_timeout', 'soap_responsetimeout', 'soap_fieldmapping', 'soap_provisionning', |
66
|
|
|
'soap_provisionning_group' |
67
|
|
|
); |
68
|
|
|
foreach ($configs as $config) { |
69
|
|
|
$config_installed = false; |
70
|
|
|
$sql = "SELECT COUNT(*) FROM " . $db->prefix('config') . " WHERE `conf_name` = '{$config}' AND `conf_modid` = 0"; |
71
|
|
|
if ($result = $db->queryF($sql)) { |
72
|
|
|
list($count) = $db->fetchRow($result); |
73
|
|
|
if ($count == 1) { |
74
|
|
|
$config_installed = true; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
if ($config_installed) { |
78
|
|
|
$sql = "DELETE FROM " . $db->prefix('config') . " WHERE `conf_name` = '{$config}' AND `conf_modid` = 0"; |
79
|
|
|
if (!$db->queryF($sql)) { |
80
|
|
|
return false; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
return true; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function apply_configoption() |
89
|
|
|
{ |
90
|
|
|
$xoops = Xoops::getInstance(); |
91
|
|
|
$db = $xoops->db(); |
92
|
|
|
$configoption_installed = false; |
93
|
|
|
$sql = "SELECT COUNT(*) FROM `" . $db->prefix('configoption') . "`" . " WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'"; |
94
|
|
|
if ($result = $db->queryF($sql)) { |
95
|
|
|
list($count) = $db->fetchRow($result); |
96
|
|
|
if ($count == 1) { |
97
|
|
|
$configoption_installed = true; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
if ($configoption_installed) { |
102
|
|
|
$sql = "DELETE FROM " . $db->prefix('configoption') . " WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'"; |
103
|
|
|
if (!$db->queryF($sql)) { |
104
|
|
|
return false; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
return true; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function __construct() |
112
|
|
|
{ |
113
|
|
|
xoopsUpgrade::__construct(basename(__DIR__)); |
|
|
|
|
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
$upg = new upgrade_240a(); |
118
|
|
|
return $upg; |
119
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.