MDL-17038 Change to use sensible variable names

Author: Peter Bulmer <peter.bulmer@catalyst.net.nz>
This commit is contained in:
peterbulmer 2008-10-30 01:16:47 +00:00
parent 6ff7d16b25
commit 995087b904

View File

@ -772,7 +772,7 @@ class auth_plugin_mnet extends auth_plugin_base {
join("\n", $mnet_request->error));
break;
}
$query = "
$mnethostlogsssql = "
SELECT
mhostlogs.remoteid, mhostlogs.time, mhostlogs.userid, mhostlogs.ip,
mhostlogs.course, mhostlogs.module, mhostlogs.cmid, mhostlogs.action,
@ -795,49 +795,51 @@ class auth_plugin_mnet extends auth_plugin_base {
INNER JOIN {course} c on c.id = mhostlogs.course
ORDER by mhostlogs.remoteid ASC";
$results = $DB->get_records_sql($query, array($mnethostid, $mnet_request->response['last log id']));
$mnethostlogs = $DB->get_records_sql($mnethostlogssql, array($mnethostid, $mnet_request->response['last log id']));
if (false == $results) continue;
if (false == $mnethostlogs) continue;
$param = array();
$processedlogs = array();
foreach($results as $result) {
if (!empty($result->modinfo) && !empty($result->cmid)) {
$modinfo = unserialize($result->modinfo);
unset($result->modinfo);
foreach($mnethostlogs as $hostlog) {
// Extract the name of the relevant module instance from the
// course modinfo if possible.
if (!empty($hostlog->modinfo) && !empty($hostlog->cmid)) {
$modinfo = unserialize($hostlog->modinfo);
unset($hostlog->modinfo);
$modulearray = array();
foreach($modinfo as $module) {
$modulearray[$module->cm] = urldecode($module->name);
}
$result->resource_name = $modulearray[$result->cmid];
$hostlog->resource_name = $modulearray[$hostlog->cmid];
} else {
$result->resource_name = '';
$hostlog->resource_name = '';
}
$param[] = array (
'remoteid' => $result->remoteid,
'time' => $result->time,
'userid' => $result->userid,
'ip' => $result->ip,
'course' => $result->course,
'coursename' => $result->coursename,
'module' => $result->module,
'cmid' => $result->cmid,
'action' => $result->action,
'url' => $result->url,
'info' => $result->info,
'resource_name' => $result->resource_name,
'username' => $result->username
$processedlogs[] = array (
'remoteid' => $hostlog->remoteid,
'time' => $hostlog->time,
'userid' => $hostlog->userid,
'ip' => $hostlog->ip,
'course' => $hostlog->course,
'coursename' => $hostlog->coursename,
'module' => $hostlog->module,
'cmid' => $hostlog->cmid,
'action' => $hostlog->action,
'url' => $hostlog->url,
'info' => $hostlog->info,
'resource_name' => $hostlog->resource_name,
'username' => $hostlog->username
);
}
unset($result);
unset($hostlog);
$mnet_request = new mnet_xmlrpc_client();
$mnet_request->set_method('auth/mnet/auth.php/refresh_log');
// set $token and $useragent parameters
$mnet_request->add_param($param);
$mnet_request->add_param($processedlogs);
if ($mnet_request->send($mnet_peer) === true) {
if ($mnet_request->response['code'] > 0) {