Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-5750

$scorm->datadir var not set correctly when creating new SCORM object

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: SCORM
    • Labels:
      None
    • Environment:
      Windows 2000
    • Affected Branches:
      MOODLE_16_STABLE

      Description

      there seems to be a few people experiencing this in the forums. in the file scorm/lib.php when scorm_update_instance is called $scorm->datadir does not contain any information so when the line:

      rename($scorm->dir.$scorm->datadir,$scorm->dir.'/'.$scorm->id);

      is called an error permission denied is given becuase it is trying to rename the moddata\scorm directory to moddata\scorm\1 instead of renaming moddata\scorm\tempdirname to moddata\scorm\1

      will try to debug and post fix here.

        Gliffy Diagrams

          Activity

          Hide
          dougiamas Martin Dougiamas added a comment -

          From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 09:46 AM:

          hmmm - found another issue in scorm\validate.php - calls the function scorm_delete_files($tempdir) - this function is in scorm\lib.php - this file is not included in validate.php so it can't use the functions inside it.

          Dan

          From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 10:25 AM:

          ahh - the reason datadir doesn't exist is because the file isn't a valid package.

          first part of this problem:

          the function scorm_validate in locallib isn't working quite right.

          these lines don't work:

          if (!isset($validation))

          { $validation->result = 'nomanifest'; $validation->pkgtype = 'SCORM'; }

          maybe should be replaced with this.

          if (!isset($validation->result)) { $validation->result = 'nomanifest'; $validation->pkgtype = 'SCORM'; }

          From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 10:52 AM:

          ok finally the function scorm_add_instance can still run even though the form doesn't validate. you shouldn't just rely on Javascript for this. - you need to place a check in scorm_add_instance early on to ensure $scorm contains valid data before you add a record to the database

          a check like this should be made:

          if (!isset($scorm->instance))

          { error(your scorm object did not validate correctly); }

          else

          { ...do other stuff in scorm_add_instance... }

          that should be all!

          Dan

          From Dan Marsden (dan at digitalclay.co.nz) Monday, 24 July 2006, 07:53 AM:

          now fixed in HEAD and 1.6_STABLE

          Show
          dougiamas Martin Dougiamas added a comment - From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 09:46 AM: hmmm - found another issue in scorm\validate.php - calls the function scorm_delete_files($tempdir) - this function is in scorm\lib.php - this file is not included in validate.php so it can't use the functions inside it. Dan From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 10:25 AM: ahh - the reason datadir doesn't exist is because the file isn't a valid package. first part of this problem: the function scorm_validate in locallib isn't working quite right. these lines don't work: if (!isset($validation)) { $validation->result = 'nomanifest'; $validation->pkgtype = 'SCORM'; } maybe should be replaced with this. if (!isset($validation->result)) { $validation->result = 'nomanifest'; $validation->pkgtype = 'SCORM'; } From Dan Marsden (dan at digitalclay.co.nz) Thursday, 8 June 2006, 10:52 AM: ok finally the function scorm_add_instance can still run even though the form doesn't validate. you shouldn't just rely on Javascript for this. - you need to place a check in scorm_add_instance early on to ensure $scorm contains valid data before you add a record to the database a check like this should be made: if (!isset($scorm->instance)) { error(your scorm object did not validate correctly); } else { ...do other stuff in scorm_add_instance... } that should be all! Dan From Dan Marsden (dan at digitalclay.co.nz) Monday, 24 July 2006, 07:53 AM: now fixed in HEAD and 1.6_STABLE

            People

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

              Dates

              • Created:
                Updated:
                Resolved: