| @@ 86-89 (lines=4) @@ | ||
| 83 | ||
| 84 | $php_errormsg = ''; |
|
| 85 | $res = @mkdir($backup_dir, $perm_dirs); |
|
| 86 | if ($res === false) { |
|
| 87 | //TODO set and handle an error message telling the user to review the permissions on the archive directory |
|
| 88 | 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); |
|
| 89 | } |
|
| 90 | // Write the course-object to the file |
|
| 91 | $fp = @fopen($course_info_file, 'w'); |
|
| 92 | if ($fp === false) { |
|
| @@ 92-94 (lines=3) @@ | ||
| 89 | } |
|
| 90 | // Write the course-object to the file |
|
| 91 | $fp = @fopen($course_info_file, 'w'); |
|
| 92 | if ($fp === false) { |
|
| 93 | 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); |
|
| 94 | } |
|
| 95 | ||
| 96 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 97 | if ($res === false) { |
|
| @@ 97-99 (lines=3) @@ | ||
| 94 | } |
|
| 95 | ||
| 96 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 97 | if ($res === false) { |
|
| 98 | 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); |
|
| 99 | } |
|
| 100 | ||
| 101 | $res = @fclose($fp); |
|
| 102 | if ($res === false) { |
|
| @@ 102-104 (lines=3) @@ | ||
| 99 | } |
|
| 100 | ||
| 101 | $res = @fclose($fp); |
|
| 102 | if ($res === false) { |
|
| 103 | 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); |
|
| 104 | } |
|
| 105 | ||
| 106 | // Copy all documents to the temp-dir |
|
| 107 | if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { |
|
| @@ 4609-4611 (lines=3) @@ | ||
| 4606 | // Simple delete for a file. |
|
| 4607 | if (is_file($dirname) || is_link($dirname)) { |
|
| 4608 | $res = unlink($dirname); |
|
| 4609 | if ($res === false) { |
|
| 4610 | error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
| 4611 | } |
|
| 4612 | return $res; |
|
| 4613 | } |
|
| 4614 | ||
| @@ 4646-4648 (lines=3) @@ | ||
| 4643 | ||
| 4644 | if ($delete_only_content_in_folder == false) { |
|
| 4645 | $res = rmdir($dirname); |
|
| 4646 | if ($res === false) { |
|
| 4647 | error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
| 4648 | } |
|
| 4649 | } |
|
| 4650 | return $res; |
|
| 4651 | } |
|