/**
 * Parse an IMS content package's manifest file to determine its structure
 * @param object $imscp
 * @param object $context
 * @return array
 */
function imscp_parse_structure($imscp, $context)
{
    $fs = get_file_storage();
    if (!($manifestfile = $fs->get_file($context->id, 'mod_imscp', 'content', $imscp->revision, '/', 'imsmanifest.xml'))) {
        return null;
    }
    imscp_parse_manifestfile($manifestfile->get_content());
}
Example #2
0
 /**
  * Parse the IMS package structure for the $imscp->structure field
  *
  * @param string $manifestfilepath the full path to the manifest file to parse
  */
 protected function parse_structure($manifestfilepath, $imscp, $context)
 {
     global $CFG;
     if (!file_exists($manifestfilepath)) {
         $this->log('missing imscp manifest file', backup::LOG_WARNING);
         return null;
     }
     $manifestfilecontents = file_get_contents($manifestfilepath);
     if (empty($manifestfilecontents)) {
         $this->log('empty imscp manifest file', backup::LOG_WARNING);
         return null;
     }
     require_once $CFG->dirroot . '/mod/imscp/locallib.php';
     return imscp_parse_manifestfile($manifestfilecontents, $imscp, $context);
 }