Minor cosmetic changes

skala
Julio Montoya 13 years ago
parent a0ac03c429
commit c2fac29c20
  1. 17
      main/coursecopy/classes/CourseArchiver.class.php
  2. 4
      main/coursecopy/classes/CourseSelectForm.class.php
  3. 2
      main/coursecopy/create_backup.php

@ -40,6 +40,7 @@ class CourseArchiver
$perm_dirs = api_get_permissions_for_new_directories();
CourseArchiver::clean_backup_dir();
// Create a temp directory
$tmp_dir_name = 'CourseArchiver_'.api_get_unique_id();
$backup_dir = api_get_path(SYS_ARCHIVE_PATH).$tmp_dir_name.'/';
@ -51,29 +52,27 @@ class CourseArchiver
$zip_file = $user['user_id'].'_'.$course->code.'_'.date("Ymd-His").'.zip';
$php_errormsg = '';
$res = @mkdir($backup_dir, $perm_dirs);
if ($res === false)
{
if ($res === false) {
//TODO set and handle an error message telling the user to review the permissions on the archive directory
error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created',0);
}
// Write the course-object to the file
$fp = @fopen($course_info_file, 'w');
if ($fp === false)
{
if ($fp === false) {
error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
}
$res = @fwrite($fp, base64_encode(serialize($course)));
if ($res === false)
{
if ($res === false) {
error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
}
$res = @fclose($fp);
if ($res === false)
{
if ($res === false) {
error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors')!=false?$php_errormsg:'error not recorded because track_errors is off in your php.ini'),0);
}
// Copy all documents to the temp-dir
// Copy all documents to the temp-dir
if (is_array($course->resources[RESOURCE_DOCUMENT])) {
foreach ($course->resources[RESOURCE_DOCUMENT] as $id => $document) {
if ($document->file_type == DOCUMENT) {

@ -200,9 +200,9 @@ class CourseSelectForm
}
function display_hidden_scorm_directories($course) {
if(is_array($course->resources)){
if (is_array($course->resources)){
foreach ($course->resources as $type => $resources) {
if(count($resources) > 0) {
if (count($resources) > 0) {
switch($type) {
case RESOURCE_SCORM:
foreach ($resources as $id=>$resource) {

@ -51,8 +51,6 @@ require_once 'classes/CourseSelectForm.class.php';
// Display the tool title
echo Display::page_header($nameTools);
/* MAIN CODE */
if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup')) {

Loading…
Cancel
Save