mnet MDL-21473 fixed a small bug in the mnet installer and updated the testclient

This commit is contained in:
Penny Leach 2010-01-29 04:09:05 +00:00
parent f54dfa54b7
commit 8509b7c431
2 changed files with 23 additions and 8 deletions

View file

@ -178,7 +178,7 @@ function upgrade_plugin_mnet_functions($component) {
$serviceobj = $servicecache[$service];
}
foreach ($methods as $method => $xmlrpcpath) {
if (!$rpcid = $DB->record_exists('mnet_remote_rpc', array('xmlrpcpath'=>$xmlrpcpath))) {
if (!$rpcid = $DB->get_field('mnet_remote_rpc', 'id', array('xmlrpcpath'=>$xmlrpcpath))) {
$remoterpc = (object)array(
'functionname' => $method,
'xmlrpcpath' => $xmlrpcpath,

View file

@ -80,19 +80,34 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
get_string('options', 'mnet'),
);
$table->data = array();
$sql = 'SELECT s.name, min(r.plugintype) AS plugintype, min(r.pluginname) AS pluginname
FROM {mnet_service} s
JOIN {mnet_service2rpc} s2r ON s2r.serviceid = s.id
JOIN {mnet_rpc} r ON r.id = s2r.rpcid
GROUP BY s.name';
$yesno = array(get_string('no'), get_string('yes'));
$serviceinfo = $DB->get_records_sql($sql);
// this query is horrible and has to be remapped afterwards, because of the non-uniqueness
// of the remoterep service (it has two plugins so far that use it)
// it's possible to get a unique list back using a subquery with LIMIT but that would break oracle
// so it's best to just do this small query and then remap the results afterwards
$sql = '
SELECT DISTINCT
' . $DB->sql_concat('r.plugintype', "'_'", 'r.pluginname', "'_'", 's.name') . ' AS unique,
s.name,
r.plugintype,
r.pluginname
FROM
{mnet_service} s
JOIN {mnet_remote_service2rpc} s2r ON s2r.serviceid = s.id
JOIN {mnet_remote_rpc} r ON r.id = s2r.rpcid';
$serviceinfo = array();
foreach ($DB->get_records_sql($sql) as $result) {
$serviceinfo[$result->name] = $result->plugintype . '_' . $result->pluginname;
}
foreach ($services as $id => $servicedata) {
if (array_key_exists($servicedata['name'], $serviceinfo)) {
$service = $serviceinfo[$servicedata['name']];
$servicedata['humanname'] = get_string($servicedata['name'].'_name', $service->plugintype . '_' . $service->pluginname);
$servicedata['humanname'] = get_string($servicedata['name'].'_name', $service);
} else {
$servicedata['humanname'] = get_string('unknown', 'mnet');
}