Ejemplo n.º 1
0
 /**
  * Clone course data directory
  *
  * @access public
  * @static
  *
  * @param string obj_id source
  * @param string obj_id target
  */
 public static function _clone($a_source_id, $a_target_id)
 {
     $source = new ilFSStorageCourse($a_source_id);
     $target = new ilFSStorageCourse($a_target_id);
     $target->create();
     ilFileSystemStorage::_copyDirectory($source->getAbsolutePath(), $target->getAbsolutePath());
     // Delete member export files
     $target->deleteDirectory($target->getMemberExportDirectory());
     unset($source);
     unset($target);
     return true;
 }
Ejemplo n.º 2
0
    $archive_ids[$row->archive_ids]['course_id'] = $row->course_id;
}
foreach ($archive_ids as $archive_id => $data) {
    // Check if done
    $query = "SELECT * FROM tmp_migration WHERE obj_id = " . $archive_id . " AND passed = 1";
    $res = $ilDB->query($query);
    if ($res->numRows()) {
        continue;
    }
    if (!@file_exists(ilUpdateUtils::getDataDir() . '/course/' . $data['name'])) {
        $ilLog->write('DB Migration 1030: Archives already migrated: No data found for archive id ' . $data['name']);
        continue;
    }
    // Rename
    $fss = new ilFSStorageCourse($data['course_id']);
    $fss->create();
    $fss->initArchiveDirectory();
    if ($fss->rename(ilUpdateUtils::getDataDir() . '/course/' . $data['name'], $fss->getArchiveDirectory() . '/' . $data['name'])) {
        $ilLog->write('DB Migration 1030: Success renaming archive ' . $data['name']);
    }
    if ($fss->rename(ilUpdateUtils::getDataDir() . '/course/' . $data['name'] . '.zip', $fss->getArchiveDirectory() . '/' . $data['name'] . '.zip')) {
        $ilLog->write('DB Migration 1030: Success renaming archive ' . $data['name'] . '.zip');
    } else {
        $ilLog->write('DB Migration 1030: Failed renaming ' . ilUpdateUtils::getDataDir() . '/course/' . $data['name'] . '-> ' . $fss->getArchiveDirectory() . '/' . $data['name']);
        continue;
    }
    // Save success
    $query = "REPLACE INTO tmp_migration SET obj_id = '" . $archive_id . "',passed = '1'";
    $ilDB->query($query);
}
?>