Fixes for the problem creating directories.

It was just a missing $CFG, but I got rid of scorm_mkdirs to use
the moodlelib equivalent instead
This commit is contained in:
moodler 2004-05-22 04:00:34 +00:00
parent 8a45aa5a95
commit e23ef951fa
2 changed files with 24 additions and 30 deletions

View file

@ -171,19 +171,11 @@ function scorm_randstring($len = "8")
return $rstring;
}
function scorm_mkdirs($strPath)
{
global $CFG;
if (is_dir($strPath))
return true;
$pStrPath = dirname($strPath);
if (!scorm_mkdirs($pStrPath))
return false;
return mkdir($strPath, $CFG->directorypermissions);
}
function scorm_datadir($strPath, $existingdir="", $prefix = "SCORM")
{
global $CFG;
if (($existingdir!="") && (is_dir($strPath.$existingdir)))
return $strPath.$existingdir;
@ -192,6 +184,7 @@ function scorm_datadir($strPath, $existingdir="", $prefix = "SCORM")
$datadir="/".$prefix.scorm_randstring();
} while (file_exists($strPath.$datadir));
mkdir($strPath.$datadir, $CFG->directorypermissions);
@chmod($strPath.$datadir, $CFG->directorypermissions); // Just in case mkdir didn't do it
return $strPath.$datadir;
} else {
return false;