Moodle

print_course() no longer works for small sites

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9
  • Component/s: Unknown
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

in course/lib.php in head:

if ($hidesitecourse and ($course->id == SITEID)) { continue; }

in the patch this has been changed to:

if ($hidesitecourse) { continue; } }

which is not correct and will hide all top-level sites (most small moodle sites). This should be undone.

Activity

Hide
Martín Langhoff added a comment -

Hey - that patch was written in the heat of things and inexcusably bogus – it would not show any courses! I've reverted it, and it will never see HEAD.

Now – the hidesitecourse thing intrigued me, and I did a walk of the callers. The $hidesitecourse option is never used in its default (false), so it is effectively dead code.

And and I cannot think of a valid use case to list the sitecourse along other courses in an end-user list of the kind print_courses() will.

Callers will do any of these

  • call with $hidesitecourse=true (index.php)
  • call with a specific category - which will never show sitecourse (course/category.php)
  • calls to print_courses(0) which could trigger display of the sitecourse have condionals that mean the sitecourse will never be shown. See the if() conditions around course/index.php

So I'll craft a patch to remove it as dead code. OTOH, if anyone can tell me of a valid use case for it I'll resurrect it (and revert the related change to get_courses_wmanager() - which automatically skips sitecourse).

Show
Martín Langhoff added a comment - Hey - that patch was written in the heat of things and inexcusably bogus – it would not show any courses! I've reverted it, and it will never see HEAD. Now – the hidesitecourse thing intrigued me, and I did a walk of the callers. The $hidesitecourse option is never used in its default (false), so it is effectively dead code. And and I cannot think of a valid use case to list the sitecourse along other courses in an end-user list of the kind print_courses() will. Callers will do any of these
  • call with $hidesitecourse=true (index.php)
  • call with a specific category - which will never show sitecourse (course/category.php)
  • calls to print_courses(0) which could trigger display of the sitecourse have condionals that mean the sitecourse will never be shown. See the if() conditions around course/index.php
So I'll craft a patch to remove it as dead code. OTOH, if anyone can tell me of a valid use case for it I'll resurrect it (and revert the related change to get_courses_wmanager() - which automatically skips sitecourse).
Hide
Martín Langhoff added a comment -

Pushed the $hidesitecourse cleanup to mdl19-perf. If there are valid use cases for this, reopen and give me one

Show
Martín Langhoff added a comment - Pushed the $hidesitecourse cleanup to mdl19-perf. If there are valid use cases for this, reopen and give me one
Hide
Martin Dougiamas added a comment -

Seems to work for me.

I just hope this change to an API hasn't broken something else somewhere.

Show
Martin Dougiamas added a comment - Seems to work for me. I just hope this change to an API hasn't broken something else somewhere.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: