Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.0
-
Fix Version/s: 2.0
-
Component/s: Enrolments
-
Labels:None
-
Environment:LAMP - external database oracle
-
Affected Branches:MOODLE_20_STABLE
-
Fixed Branches:MOODLE_20_STABLE
Description
follow the moodle docs in order to run an enrolment sync: http://docs.moodle.org/en/External_database
When you run it, there is a loop.
The error is :
Notice: Undefined property: stdClass::$extuser in /home/jerome/Projects/Moodle_HEAD/moodle/enrol/database/enrol.php on line 282
Call Stack:
0.0014 125416 1. {main}() /home/jerome/Projects/Moodle_HEAD/moodle/enrol/database/enrol_database_sync.php:0
0.3043 21667088 2. enrolment_plugin_database->sync_enrolments() /home/jerome/Projects/Moodle_HEAD/moodle/enrol/database/enrol_database_sync.php:34
>>>>> extuser is the fieldname of userid in my external database
I added a print_r():
280. while ($crs_obj = (object)$crs->FetchRow()) {
281. $crs_obj = (object)array_change_key_case((array)$crs_obj , CASE_LOWER);
282. print_r($crs_obj);
283. array_push($extenrolments, $crs_obj->{$CFG->enrol_remoteuserfield});
284. }
I obtained this display:
stdClass Object
(
[extuser] => 3
)
stdClass Object
(
[extuser] => 4
)
stdClass Object
(
[scalar] =>
)
I guess the scalar attribut cause problem (I didn't look further)
Attachments
Issue Links
| This issue has a non-specific relationship to: | ||||
| MDL-16043 | Enrolment sync need to be cross-db |
|
|
|
I attached a patch for another section of the enrolment that is buggy (and that just break badly Moodle if ever you activate Moodle enrol sync). Mainly, all "fetch while" need to be changed in foreach :
// Old syntax
while($result = rs_fetch_next_record($rs)) {
...
}
rs_close();
// New syntax
foreach ($rs as $result) {
...
}
$rs->close();
I'll have a look at that.