mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
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:
parent
8a45aa5a95
commit
e23ef951fa
2 changed files with 24 additions and 30 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue