| @@ 85-88 (lines=4) @@ | ||
| 82 | ||
| 83 | $php_errormsg = ''; |
|
| 84 | $res = @mkdir($backup_dir, $perm_dirs); |
|
| 85 | if ($res === false) { |
|
| 86 | //TODO set and handle an error message telling the user to review the permissions on the archive directory |
|
| 87 | 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); |
|
| 88 | } |
|
| 89 | // Write the course-object to the file |
|
| 90 | $fp = @fopen($course_info_file, 'w'); |
|
| 91 | if ($fp === false) { |
|
| @@ 91-93 (lines=3) @@ | ||
| 88 | } |
|
| 89 | // Write the course-object to the file |
|
| 90 | $fp = @fopen($course_info_file, 'w'); |
|
| 91 | if ($fp === false) { |
|
| 92 | 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); |
|
| 93 | } |
|
| 94 | ||
| 95 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 96 | if ($res === false) { |
|
| @@ 96-98 (lines=3) @@ | ||
| 93 | } |
|
| 94 | ||
| 95 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 96 | if ($res === false) { |
|
| 97 | 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); |
|
| 98 | } |
|
| 99 | ||
| 100 | $res = @fclose($fp); |
|
| 101 | if ($res === false) { |
|
| @@ 101-103 (lines=3) @@ | ||
| 98 | } |
|
| 99 | ||
| 100 | $res = @fclose($fp); |
|
| 101 | if ($res === false) { |
|
| 102 | 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); |
|
| 103 | } |
|
| 104 | ||
| 105 | // Copy all documents to the temp-dir |
|
| 106 | if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { |
|
| @@ 4512-4514 (lines=3) @@ | ||
| 4509 | // Simple delete for a file. |
|
| 4510 | if (is_file($dirname) || is_link($dirname)) { |
|
| 4511 | $res = unlink($dirname); |
|
| 4512 | if ($res === false) { |
|
| 4513 | 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); |
|
| 4514 | } |
|
| 4515 | return $res; |
|
| 4516 | } |
|
| 4517 | ||
| @@ 4549-4551 (lines=3) @@ | ||
| 4546 | ||
| 4547 | if ($delete_only_content_in_folder == false) { |
|
| 4548 | $res = rmdir($dirname); |
|
| 4549 | if ($res === false) { |
|
| 4550 | 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); |
|
| 4551 | } |
|
| 4552 | } |
|
| 4553 | return $res; |
|
| 4554 | } |
|