mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-17038 Change to use sensible variable names
Author: Peter Bulmer <peter.bulmer@catalyst.net.nz>
This commit is contained in:
parent
6ff7d16b25
commit
995087b904
@ -772,7 +772,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
|||||||
join("\n", $mnet_request->error));
|
join("\n", $mnet_request->error));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$query = "
|
$mnethostlogsssql = "
|
||||||
SELECT
|
SELECT
|
||||||
mhostlogs.remoteid, mhostlogs.time, mhostlogs.userid, mhostlogs.ip,
|
mhostlogs.remoteid, mhostlogs.time, mhostlogs.userid, mhostlogs.ip,
|
||||||
mhostlogs.course, mhostlogs.module, mhostlogs.cmid, mhostlogs.action,
|
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
|
INNER JOIN {course} c on c.id = mhostlogs.course
|
||||||
ORDER by mhostlogs.remoteid ASC";
|
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) {
|
foreach($mnethostlogs as $hostlog) {
|
||||||
if (!empty($result->modinfo) && !empty($result->cmid)) {
|
// Extract the name of the relevant module instance from the
|
||||||
$modinfo = unserialize($result->modinfo);
|
// course modinfo if possible.
|
||||||
unset($result->modinfo);
|
if (!empty($hostlog->modinfo) && !empty($hostlog->cmid)) {
|
||||||
|
$modinfo = unserialize($hostlog->modinfo);
|
||||||
|
unset($hostlog->modinfo);
|
||||||
$modulearray = array();
|
$modulearray = array();
|
||||||
foreach($modinfo as $module) {
|
foreach($modinfo as $module) {
|
||||||
$modulearray[$module->cm] = urldecode($module->name);
|
$modulearray[$module->cm] = urldecode($module->name);
|
||||||
}
|
}
|
||||||
$result->resource_name = $modulearray[$result->cmid];
|
$hostlog->resource_name = $modulearray[$hostlog->cmid];
|
||||||
} else {
|
} else {
|
||||||
$result->resource_name = '';
|
$hostlog->resource_name = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$param[] = array (
|
$processedlogs[] = array (
|
||||||
'remoteid' => $result->remoteid,
|
'remoteid' => $hostlog->remoteid,
|
||||||
'time' => $result->time,
|
'time' => $hostlog->time,
|
||||||
'userid' => $result->userid,
|
'userid' => $hostlog->userid,
|
||||||
'ip' => $result->ip,
|
'ip' => $hostlog->ip,
|
||||||
'course' => $result->course,
|
'course' => $hostlog->course,
|
||||||
'coursename' => $result->coursename,
|
'coursename' => $hostlog->coursename,
|
||||||
'module' => $result->module,
|
'module' => $hostlog->module,
|
||||||
'cmid' => $result->cmid,
|
'cmid' => $hostlog->cmid,
|
||||||
'action' => $result->action,
|
'action' => $hostlog->action,
|
||||||
'url' => $result->url,
|
'url' => $hostlog->url,
|
||||||
'info' => $result->info,
|
'info' => $hostlog->info,
|
||||||
'resource_name' => $result->resource_name,
|
'resource_name' => $hostlog->resource_name,
|
||||||
'username' => $result->username
|
'username' => $hostlog->username
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($result);
|
unset($hostlog);
|
||||||
|
|
||||||
$mnet_request = new mnet_xmlrpc_client();
|
$mnet_request = new mnet_xmlrpc_client();
|
||||||
$mnet_request->set_method('auth/mnet/auth.php/refresh_log');
|
$mnet_request->set_method('auth/mnet/auth.php/refresh_log');
|
||||||
|
|
||||||
// set $token and $useragent parameters
|
// 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->send($mnet_peer) === true) {
|
||||||
if ($mnet_request->response['code'] > 0) {
|
if ($mnet_request->response['code'] > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user