/** * Restores this module into the given course * @access public * @param int $course_id ID of the course to restore into * @param string $version version number of the ATutor installation used to make this backup * @param string $import_dir the path to the import directory * @author Joel Kronenberg */ function restore($course_id, $version, $import_dir) { static $CSVImport; if (!file_exists($this->_module_path . $this->_directoryName . '/module_backup.php')) { return; } if (!isset($CSVImport)) { require_once AT_INCLUDE_PATH . 'classes/CSVImport.class.php'; $CSVImport = new CSVImport(); } require $this->_module_path . $this->_directoryName . '/module_backup.php'; if (isset($sql)) { foreach ($sql as $table_name => $table_sql) { $CSVImport->import($table_name, $import_dir, $course_id, $version); } } if ($this->_directoryName == '_core/content') { if (version_compare($version, '1.6.4', '<')) { $this->convertContent164($course_id); } } if (isset($dirs)) { foreach ($dirs as $src => $dest) { $dest = str_replace('?', $course_id, $dest); copys($import_dir . $src, $dest); } } }