Hi,
I'm upgrading from 1.5.2 to 1.5.3+ 2005060230 (latest CVS checkout from about an hour before this post). Database update fails on the second step with the error:
Fatal error: Call to undefined function category_parent_visible() in /web/moodle15/root/lib/datalib.php on line 2358
Page is admin/index.php. Hitting Refresh yields the same message. Update went through fine when I added:
include_once("../course/lib.php");
in the file lib/datalib.php (lines 2357 to 2359):
foreach ($categories as $key => $category) {
include_once("../course/lib.php");
if (!$category->visible || !category_parent_visible($category->parent)) {
Thoughts?
I'm getting the exact same error. I did a CVS update and now my Moodle is broken. Students can't use the website, any thoughts??
Exact Error I'm getting:
Fatal error: Call to undefined function: category_parent_visible() in /home_dir_here/lib/datalib.php on line 2358
category_parent_visible should be in the same file so I guess that the file datalib.php was only partially downloaded, or at that moment in time there was a glitch with CVS.
That was my fault. Those functions are now moved to datalib.
A cvs update would fix this problem.
A cvs update would fix this problem.
A CVS update was how I **GOT** the problem
Dan
Unfortunately, there is a delay between developer CVS and anonymous CVS, so doing a CVS update right now is not going to solve anything. I'm not sure how long this delay is, but in the meantime, attached are the correct files (course/lib.php and lib/datalib.php) .. just unzip this file into your moodle directory.
Ahhhh... Thank you very much Penny... much appreciated. My students have access now
Dan
no problem
Next time you upgrade, run
cvs up -C course/lib.php lib/datalib.php
first, which will overwrite any local changes. Just in case cvs gets confused ;)
( -C means clobber )
Next time you upgrade, run
cvs up -C course/lib.php lib/datalib.php
first, which will overwrite any local changes. Just in case cvs gets confused ;)
( -C means clobber )
datalib.php is still Buggy.
Today, I created some new students and got the following error(s) at login:
<>Warning
Dan
I guess the problem is the new code that tries to hide courses marked as not visible. When the student is not enroled in any course (like your new student), that code produces the warning you are seeing (but is harmless otherwise).
I suppose something like the following might do the trick (just add the bold+underlined lines):
I suppose something like the following might do the trick (just add the bold+underlined lines):
if (!empty ($course)) {
$courses = get_records_list('course', 'id', implode(',', $course));
foreach ($courses as $k => $c) {
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
unset($course[$c->id]);
}
}
}
Saludos. Iñaki.
I'm committing a patch to cvs shortly to fix this warning.
(It's benign, by the way)
(It's benign, by the way)
I think the fix you commited on CVS is wrong. It tests whether count($courses) is greater than 0, but you should be testing count($course), as this is the array we fill in above the test. $courses is set below the test, from the database query. So someone should apply this to CVS:
--- datalib.php.orig 2005-12-30 14:57:15.000000000 +0100Saludos. Iñaki.
+++ datalib.php 2005-12-30 14:57:31.000000000 +0100
@@ -2227,7 +2227,7 @@
$course[$student->course] = $student->course;
}
}
- if (count($courses) > 0) {
+ if (count($course) > 0) {
$courses = get_records_list('course', 'id', implode(',', $course));
foreach ($courses as $k => $c) {
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
How about:
$courses = get_records_list('course', 'id', implode(',', $course)); if (is_array($courses)) {
foreach ($courses as $k => $c) { if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) { unset($course[$c->id]); } } }
My additions underlined.