| @@ 57-60 (lines=4) @@ | ||
| 54 | $zip_file = $user['user_id'] . '_' . $course->code . '_' . $date->format('Ymd-His') . '.zip'; |
|
| 55 | $php_errormsg = ''; |
|
| 56 | $res = @mkdir($backup_dir, $perm_dirs); |
|
| 57 | if ($res === false) { |
|
| 58 | //TODO set and handle an error message telling the user to review the permissions on the archive directory |
|
| 59 | 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); |
|
| 60 | } |
|
| 61 | // Write the course-object to the file |
|
| 62 | $fp = @fopen($course_info_file, 'w'); |
|
| 63 | if ($fp === false) { |
|
| @@ 63-65 (lines=3) @@ | ||
| 60 | } |
|
| 61 | // Write the course-object to the file |
|
| 62 | $fp = @fopen($course_info_file, 'w'); |
|
| 63 | if ($fp === false) { |
|
| 64 | 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); |
|
| 65 | } |
|
| 66 | ||
| 67 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 68 | if ($res === false) { |
|
| @@ 68-70 (lines=3) @@ | ||
| 65 | } |
|
| 66 | ||
| 67 | $res = @fwrite($fp, base64_encode(serialize($course))); |
|
| 68 | if ($res === false) { |
|
| 69 | 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); |
|
| 70 | } |
|
| 71 | ||
| 72 | $res = @fclose($fp); |
|
| 73 | if ($res === false) { |
|
| @@ 73-75 (lines=3) @@ | ||
| 70 | } |
|
| 71 | ||
| 72 | $res = @fclose($fp); |
|
| 73 | if ($res === false) { |
|
| 74 | 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); |
|
| 75 | } |
|
| 76 | ||
| 77 | // Copy all documents to the temp-dir |
|
| 78 | if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { |
|
| @@ 4740-4742 (lines=3) @@ | ||
| 4737 | // Simple delete for a file. |
|
| 4738 | if (is_file($dirname) || is_link($dirname)) { |
|
| 4739 | $res = unlink($dirname); |
|
| 4740 | if ($res === false) { |
|
| 4741 | 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); |
|
| 4742 | } |
|
| 4743 | return $res; |
|
| 4744 | } |
|
| 4745 | ||
| @@ 4777-4779 (lines=3) @@ | ||
| 4774 | ||
| 4775 | if ($delete_only_content_in_folder == false) { |
|
| 4776 | $res = rmdir($dirname); |
|
| 4777 | if ($res === false) { |
|
| 4778 | 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); |
|
| 4779 | } |
|
| 4780 | } |
|
| 4781 | return $res; |
|
| 4782 | } |
|