Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.9.3
    • Fix Version/s: 2.0.10
    • Component/s: Backup
    • Labels:
      None
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      373

      Description

      The gradebook API offers the use of itemnumber for when an activity has multiple graded items in a single instance. My understanding is that this has to be a unique ID, like one from a table used by the activity module. On restore though, this value is not relinked, but rather stays set to the original value in the backup file. Using a non-unique ID is not an option as backups could conflict when being restored to another site.

      The solution that first came to mind is to write up a new restore method hook that is stored in mod/modname/restorelib.php that has the sole purpose of relinking this ID to a new one.

      1. restorelib.patch
        1 kB
        Mark Nielsen
      2. restorelib.php
        0.4 kB
        Mark Nielsen

        Activity

        Hide
        Mark Nielsen added a comment -

        Here is a proposed solution. It only works for modules and I wasn't sure how strict the re-linking should be. The code only skips the creation of the graded item if the function exists in the module's restorelib.php and the function returns false. The other place we may want this to skip the creation is if the function doesn't exist as it probably will create an invalid graded item.

        Show
        Mark Nielsen added a comment - Here is a proposed solution. It only works for modules and I wasn't sure how strict the re-linking should be. The code only skips the creation of the graded item if the function exists in the module's restorelib.php and the function returns false. The other place we may want this to skip the creation is if the function doesn't exist as it probably will create an invalid graded item.
        Hide
        Mark Nielsen added a comment -

        Attaching an example implementation of the new hook in the module's restorelib.php file.

        Show
        Mark Nielsen added a comment - Attaching an example implementation of the new hook in the module's restorelib.php file.
        Hide
        Petr Škoda added a comment -

        Hello,
        this looks like a good candidate for 2.0 backup/restore rewrite.
        Thanks for the report and patch.

        Petr

        Show
        Petr Škoda added a comment - Hello, this looks like a good candidate for 2.0 backup/restore rewrite. Thanks for the report and patch. Petr
        Hide
        Helen Foster added a comment -

        Editing the issue component.

        Show
        Helen Foster added a comment - Editing the issue component.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

        For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

        Show
        Eloy Lafuente (stronk7) added a comment - This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

          People

          • Votes:
            7 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: