blocking the creation of backups if the archive folder is not writable see #3729

skala
Julio Montoya 13 years ago
parent d97cb1bbdf
commit d58c60ffc4
  1. 5
      main/coursecopy/create_backup.php
  2. 11
      main/inc/lib/main_api.lib.php

@ -15,8 +15,11 @@ $language_file = array('exercice', 'admin', 'coursebackup');
// Including the global initialization file
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
api_check_archive_dir();
// Check access rights (only teachers are allowed here)
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
@ -48,6 +51,8 @@ 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')) {

@ -5794,7 +5794,7 @@ function api_resource_is_locked_by_gradebook($item_id, $link_type, $course_code
* @param string course code
* @return boolean
*/
function block_course_item_locked_by_gradebook($item_id, $link_type, $course_code = null) {
function api_block_course_item_locked_by_gradebook($item_id, $link_type, $course_code = null) {
if (api_is_platform_admin()) {
return false;
}
@ -5805,7 +5805,7 @@ function block_course_item_locked_by_gradebook($item_id, $link_type, $course_cod
}
}
function check_php_version($my_inc_path = null) {
function api_check_php_version($my_inc_path = null) {
if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) {
$global_error_code = 1;
// Incorrect PHP version
@ -5815,4 +5815,11 @@ function check_php_version($my_inc_path = null) {
}
exit;
}
}
function api_check_archive_dir() {
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning');
api_not_allowed(true, $message);
}
}
Loading…
Cancel
Save