Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: DEV backlog
    • Fix Version/s: 2.1
    • Component/s: SCORM
    • Labels:
      None
    • Rank:
      1234

      Activity

      Hide
      Aparup Banerjee added a comment -

      mod/scorm/db/upgrade.php references a 'grademethodfixed' flag , if on, $scorm->grademethod = $scorm->grademethod%10;
      its for 'fix bad usage of whatgrade/grading method.'

      backed up scorm modules don't carry this flag, how then do we transform a scorm 1.9 backup reliably?

      is scorm->grademethod a constant or just a number?

      Show
      Aparup Banerjee added a comment - mod/scorm/db/upgrade.php references a 'grademethodfixed' flag , if on, $scorm->grademethod = $scorm->grademethod%10; its for 'fix bad usage of whatgrade/grading method.' backed up scorm modules don't carry this flag, how then do we transform a scorm 1.9 backup reliably? is scorm->grademethod a constant or just a number?
      Hide
      Dan Marsden added a comment -

      that whole grading method thing was a mess - it tried to store the value of 2 separate config options into one field but it didn't work reliably in the first place - I'd just pretend it was always 2 seperate options.

      from memory the whatgrade field was added in Moodle 1.9.3 so the handling will only apply to backups prior to 1.9.3 and SCORM was crap in previous versions so people using earlier versions of Moodle will find SCORM doesn't work anyway.

      hope that helps.

      Show
      Dan Marsden added a comment - that whole grading method thing was a mess - it tried to store the value of 2 separate config options into one field but it didn't work reliably in the first place - I'd just pretend it was always 2 seperate options. from memory the whatgrade field was added in Moodle 1.9.3 so the handling will only apply to backups prior to 1.9.3 and SCORM was crap in previous versions so people using earlier versions of Moodle will find SCORM doesn't work anyway. hope that helps.
      Hide
      Aparup Banerjee added a comment -

      i'll await a api call to get the moodle_version that backup was made in, that'll help decide running the data fix

      Show
      Aparup Banerjee added a comment - i'll await a api call to get the moodle_version that backup was made in, that'll help decide running the data fix
      Hide
      Aparup Banerjee added a comment -
      Show
      Aparup Banerjee added a comment - see also: https://github.com/mudrd8mz/moodle/pull/3
      Hide
      Aparup Banerjee added a comment -

      attached scorm test backup

      Show
      Aparup Banerjee added a comment - attached scorm test backup
      Hide
      Aparup Banerjee added a comment -

      just notes on (@todo) migrating the scorm file:
      ref: https://github.com/mudrd8mz/moodle/commit/671c870b513bbb4dc0330f73af02786b2d65129d

      (14:56:10) david: In your process_scorm() method (or whatever name of your root method is) you will want something like
      $this->fileman = $this->converter->get_file_manager($contextid, 'mod_scorm');
      (14:58:20) david: then, to convert zip/pif $scorm->reference
      (14:59:57) david:
      $this->fileman->filearea = 'package';
      $this->fileman->migrate_file($scorm->reference);
      (15:01:53) david: sorry, the migrate_file() needs full path like:
      $this->get_converter->get_tempdir_path().'/'.$scorm->reference
      (15:03:16) david: Just look at the moodle1_file_manager class - it uses some public properties that you can set and then call either migrate_file() or migrate_directory() methods
      (15:04:25) david: those public properties form the artificial file record: contextid, component, filearea, itemid and userid. the initial values can be set by constructor
      (15:05:05) david: and then on </MOD> just dump the filerefs into inforef.xml

      thanks David,i should get around to this soon.
      cheers,
      Aparup

      Show
      Aparup Banerjee added a comment - just notes on (@todo) migrating the scorm file: ref: https://github.com/mudrd8mz/moodle/commit/671c870b513bbb4dc0330f73af02786b2d65129d (14:56:10) david: In your process_scorm() method (or whatever name of your root method is) you will want something like $this->fileman = $this->converter->get_file_manager($contextid, 'mod_scorm'); (14:58:20) david: then, to convert zip/pif $scorm->reference (14:59:57) david: $this->fileman->filearea = 'package'; $this->fileman->migrate_file($scorm->reference); (15:01:53) david: sorry, the migrate_file() needs full path like: $this->get_converter->get_tempdir_path().'/'.$scorm->reference (15:03:16) david: Just look at the moodle1_file_manager class - it uses some public properties that you can set and then call either migrate_file() or migrate_directory() methods (15:04:25) david: those public properties form the artificial file record: contextid, component, filearea, itemid and userid. the initial values can be set by constructor (15:05:05) david: and then on </MOD> just dump the filerefs into inforef.xml thanks David,i should get around to this soon. cheers, Aparup
      Hide
      David Mudrak added a comment -

      Looking good so far. Please note I added a section http://docs.moodle.org/en/Development:Backup_1.9_conversion_for_developers#Files_migration explaining the files conversion a bit. Ping me anytime should you face some blockades. Cheers!

      Show
      David Mudrak added a comment - Looking good so far. Please note I added a section http://docs.moodle.org/en/Development:Backup_1.9_conversion_for_developers#Files_migration explaining the files conversion a bit. Ping me anytime should you face some blockades. Cheers!
      Hide
      Aparup Banerjee added a comment -

      David, i've added handling the scorm file migration. please have a look (created github pull too)

      Show
      Aparup Banerjee added a comment - David, i've added handling the scorm file migration. please have a look (created github pull too)
      Hide
      David Mudrak added a comment -

      Hi Apu. Looks pretty good! I've got some cosmetic comments though.

      • Please see my in-line comments on the pull request: a "workshop" is mentioned in a comment, there is one extra space and a missing blank line (purist am I right? )
      • Please move the generation of the file inforef.xml to the on_scorm_end(). See the wiki tutorial on how to get the id of the migrated file. The point is that once we start implementing user data support, the inforef.xml will contain references to users, roles, scales etc. And the data needed for that may be available not before the </MOD>.
      Show
      David Mudrak added a comment - Hi Apu. Looks pretty good! I've got some cosmetic comments though. Please see my in-line comments on the pull request: a "workshop" is mentioned in a comment, there is one extra space and a missing blank line (purist am I right? ) Please move the generation of the file inforef.xml to the on_scorm_end(). See the wiki tutorial on how to get the id of the migrated file. The point is that once we start implementing user data support, the inforef.xml will contain references to users, roles, scales etc. And the data needed for that may be available not before the </MOD>.
      Hide
      Aparup Banerjee added a comment -

      Thanks David,

      • purified
      • inforef.xml generation made future friendly

      tested fine too, it should be all good now (dance)

      Show
      Aparup Banerjee added a comment - Thanks David, purified inforef.xml generation made future friendly tested fine too, it should be all good now (dance)
      Hide
      David Mudrak added a comment -

      Thanks Apu, looks good.

      Show
      David Mudrak added a comment - Thanks Apu, looks good.
      Hide
      David Mudrak added a comment -

      Merged into the pre-integration branch.

      Show
      David Mudrak added a comment - Merged into the pre-integration branch.

        People

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

          Dates

          • Created:
            Updated:
            Resolved: