Moodle
  1. Moodle
  2. MDL-15156

"Host or course not found" from Admin->Networking->Enrolments course links

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.9
    • Fix Version/s: 1.9.2
    • Component/s: MNet
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      24413

      Description

      "Host or course not found" error from from Admin->Networking->Enrolments course links, because the course id within the href is missing.

      Eg:

      http://example.com/admin/mnet/enr_course_enrol.php?host=3&courseid=&sesskey=blahxyz123

      This is happening due to a schema mismatch.

      The remote moodle has the mdl_course.sortorder field defined as INTEGER, but in the source Moodle, the mdl_mnet_enrol_course.sortorder field is a SMALLINT. In this case, the sortorders are outside the range of a smallint, and the insert is failing, and so the id is coming back empty (from insert_record).

        Activity

        Hide
        Luke Hudson added a comment -

        ^ assigned to MartinD, as a reminder to change default Moodle Networking assignee.

        Show
        Luke Hudson added a comment - ^ assigned to MartinD, as a reminder to change default Moodle Networking assignee.
        Hide
        Luke Hudson added a comment -

        I'm not sure why the sortorder field contains such large numbers, in the first place.
        In this case, there are only 48 courses, but the sortorders are nearly all in the range 50,000-90,000. This could be another bug?
        In any case, the MNET schema should match the Moodle schema it is caching.

        I'm not sure how best to fix this in an upgrade script, since I'll need to apply this fix to several Moodles of different versions...

        Show
        Luke Hudson added a comment - I'm not sure why the sortorder field contains such large numbers, in the first place. In this case, there are only 48 courses, but the sortorders are nearly all in the range 50,000-90,000. This could be another bug? In any case, the MNET schema should match the Moodle schema it is caching. I'm not sure how best to fix this in an upgrade script, since I'll need to apply this fix to several Moodles of different versions...
        Hide
        Petr Škoda added a comment -

        1/ Please no changes in db structure without confirmation from MD next time.
        2/ The upgrade code must be committed into HEAD too
        3/ sure - the course sort order is borked and always was - it needs a rewrite

        Show
        Petr Škoda added a comment - 1/ Please no changes in db structure without confirmation from MD next time. 2/ The upgrade code must be committed into HEAD too 3/ sure - the course sort order is borked and always was - it needs a rewrite
        Hide
        Luke Hudson added a comment -

        Right, sorry about that, I was trying to find some indication of etiquette, but failed to discover it.
        I tried to commit the upgrade code to HEAD, but I was confused by the comment in HEAD's version of lib/db/upgrade.php
        Thanks for the response Petr,

        • Luke
        Show
        Luke Hudson added a comment - Right, sorry about that, I was trying to find some indication of etiquette, but failed to discover it. I tried to commit the upgrade code to HEAD, but I was confused by the comment in HEAD's version of lib/db/upgrade.php Thanks for the response Petr, Luke
        Hide
        Luke Hudson added a comment -

        So, I'll commit the upgrade code to HEAD too now?

        Show
        Luke Hudson added a comment - So, I'll commit the upgrade code to HEAD too now?
        Hide
        Luke Hudson added a comment -

        Proposed patch against cvs HEAD, for lib/db/upgrade.php

        Show
        Luke Hudson added a comment - Proposed patch against cvs HEAD, for lib/db/upgrade.php
        Hide
        Luke Hudson added a comment -

        Before I commit any more changes, perhaps someone could review the attached patch? I'd be grateful, as I'm not very familiar with the new DB routines.
        Cheers – Luke

        Show
        Luke Hudson added a comment - Before I commit any more changes, perhaps someone could review the attached patch? I'd be grateful, as I'm not very familiar with the new DB routines. Cheers – Luke
        Hide
        Petr Škoda added a comment -

        it is missing upgrade_main_savepoint() call (alse in 19 branch), it seems fine otherwise

        Show
        Petr Škoda added a comment - it is missing upgrade_main_savepoint() call (alse in 19 branch), it seems fine otherwise
        Hide
        Luke Hudson added a comment -

        Thanks Petr. Adding that, and committing...

        Show
        Luke Hudson added a comment - Thanks Petr. Adding that, and committing...
        Hide
        Petr Škoda added a comment -

        thanks, fixed MOODLE_19_MERGED tag and closing

        Show
        Petr Škoda added a comment - thanks, fixed MOODLE_19_MERGED tag and closing
        Hide
        Petr Škoda added a comment -

        btw the course sorting was fixed in HEAD recently, though the numbers there are still high, but not growing anymore

        Show
        Petr Škoda added a comment - btw the course sorting was fixed in HEAD recently, though the numbers there are still high, but not growing anymore

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: