All has been well until the last step up to 1.9.
We now see the following error in place of the right hand blocks on the front page:
Fatal error: Call to a member function Close() on a non-object in D:\websites\Moodle\lib\dmllib.php on line 853
Turning on debugging yields:
Unknown column 'g.courseid' in 'where clause'
SELECT ctx.* FROM mdl_context ctx WHERE ctx.path LIKE '/1/28/113/142/%' AND ctx.contextlevel IN (70,80) UNION SELECT ctx.* FROM mdl_context ctx JOIN mdl_groups g ON (ctx.instanceid=g.id AND ctx.contextlevel=60) WHERE g.courseid=1311 UNION SELECT ctx.* FROM mdl_context ctx JOIN mdl_block_pinned b ON (ctx.instanceid=b.blockid AND ctx.contextlevel=80) WHERE b.pagetype='course-view'
line 686 of lib\dmllib.php: call to debugging()
line 3790 of lib\accesslib.php: call to get_recordset_sql()
line 348 of lib\pagelib.php: call to get_child_contexts()
line 364 of lib\pagelib.php: call to page_course->init_full()
line 94 of course\view.php: call to page_course->user_allowed_editing()
Incorrect rs used!
line 814 of lib\dmllib.php: call to debugging()
line 3792 of lib\accesslib.php: call to rs_fetch_next_record()
line 348 of lib\pagelib.php: call to get_child_contexts()
line 364 of lib\pagelib.php: call to page_course->init_full()
line 94 of course\view.php: call to page_course->user_allowed_editing()
Anyone have any idea how to troubleshoot this?
Thanks in advance,
Nick
We have not enabled debugging to see if the same lines are causing the problem.
Anyone else experiencing this or have an idea how to fix?
I would recommend that you use the highest version number available when upgrading from one version to the next.
Thanks,
Matt
please make sure you followed steps described in
http://docs.moodle.org/en/Upgrade
Did you go to http://yourmoodle/admin/ in order to trigger the upgrade?
Petr
I have the same problem before I went from version 1.8.3 to 1.9 and it would not update to the new version.
I then updated to version 1.8.4 before going to 1.9 and it went through the update procedure. However at the end I am getting the message below. This is with debugging turned on:
SELECT ctx.path, ctx.instanceid, ctx.contextlevel, ra.hidden, r.id AS roleid, r.name as rolename, u.id AS userid, u.firstname, u.lastname FROM mdl_role_assignments ra JOIN mdl_context ctx ON ra.contextid = ctx.id JOIN mdl_user u ON ra.userid = u.id JOIN mdl_role r ON ra.roleid = r.id LEFT OUTER JOIN mdl_course c ON (ctx.instanceid=c.id AND ctx.contextlevel=50) WHERE ( c.id IS NOT NULL OR ra.contextid IN (,1,6,3403,5355,80,3539,3404,82,72,84,5,9,38,18,8,30,50,41,4,13,24,22,33,26,54,4413,78,77,1298,3538,185,3609,3610,3405,3540,3566,3765,11,1385,35,5289) ) AND ra.roleid IN (3) ORDER BY r.sortorder ASC, ctx.contextlevel ASC, ra.sortorder ASC
- line 686 of lib\dmllib.php: call to debugging()
- line 727 of lib\datalib.php: call to get_recordset_sql()
- line 1796 of course\lib.php: call to get_courses_wmanagers()
- line 223 of index.php: call to print_courses()
- line 814 of lib\dmllib.php: call to debugging()
- line 731 of lib\datalib.php: call to rs_fetch_next_record()
- line 1796 of course\lib.php: call to get_courses_wmanagers()
- line 223 of index.php: call to print_courses()
Fatal error: Call to a member function Close() on a non-object in C:\AppServer\xampp\htdocs\moodle\lib\dmllib.php on line 853
The SQL syntax error is indicated as being near the long list of numbers of context id's; that list is immediately preceded by a comma, which is preceded by a left parenthesis, in the SQL query. That initial comma could be the problem. The php code that generates that query is buggy. I don't know exactly where it is, because I don't have 1.9. I've got enough problems trying to understand 1.8.3! But my guess would be it's in one of the php files listed in your error msg. (dmlib.php, datalib.php, etc.).
RLE
thanks i had to go into datalib.php and change this;
if (count($managerroles)) {
if ($allcats === true) {
$catpaths = array_unique($catpaths);
$ctxids = array();
foreach ($catpaths as $cpath) {
$ctxids = array_merge($ctxids, explode('/',substr($cpath,1)));
}
$ctxids = array_unique($ctxids);
$catctxids = implode( ',' , $ctxids);
unset($catpaths);unset($cpath);
to this
if (count($managerroles)) {
if ($allcats === true) {
$catpaths = array_unique($catpaths);
$ctxids = array();
foreach ($catpaths as $cpath) {
$ctxids = array_merge($ctxids, explode('/',substr($cpath,1)));
}
$ctxids = array_unique($ctxids);
$catctxids = implode( ',' , $ctxids);
$catctxids = substr($catctxids, 1);
unset($catpaths);unset($cpath);
Trimming the substring to get rid of a leading comma. What a palava. Is this a bug which needs to be fixed or something wrong with my installation?