diff --git a/classes/local/manager/backup_manager.php b/classes/local/manager/backup_manager.php index 89ee0864923d908f7f41e022a7a97025f150ea54..ab73464127a0fe574b13abc037232bb8d0ffa74a 100644 --- a/classes/local/manager/backup_manager.php +++ b/classes/local/manager/backup_manager.php @@ -58,7 +58,7 @@ class backup_manager { $archivefile = date("Y-m-d") . "-ID-{$recordid}-COURSE-{$courseid}.mbz"; // Path of backup folder. - $path = $CFG->dataroot . '/lifecycle_backups'; + $path = get_config('tool_lifecycle', 'backup_path'); // If the path doesn't exist, make it so! if (!is_dir($path)) { umask(0000); @@ -119,7 +119,7 @@ class backup_manager { $targetfilename = \restore_controller::get_tempdir_name($backuprecord->courseid, get_admin()->id); $target = $backuptmpdir . '/' . $targetfilename; // Create the location of the actual backup file. - $source = $CFG->dataroot . '/lifecycle_backups/' . $backuprecord->backupfile; + $source = get_config('tool_lifecycle', 'backup_path') . DIRECTORY_SEPARATOR . $backuprecord->backupfile; // Check if the backup file exists. if (!file_exists($source)) { throw new \moodle_exception('errorbackupfiledoesnotexist', 'tool_lifecycle', $source); diff --git a/lang/en/tool_lifecycle.php b/lang/en/tool_lifecycle.php index 95755a1eeb51806594e84c923b14c1eba356cf6e..53ea9c9d5ac4b6dcb00d328fcaeaa5cb747ed91a 100644 --- a/lang/en/tool_lifecycle.php +++ b/lang/en/tool_lifecycle.php @@ -34,6 +34,9 @@ $string['config_delay_duration'] = 'Default duration of a course delay'; $string['config_delay_duration_desc'] = 'This setting defines the default delay duration of a workflow in case one of its processes is rolled back or finishes. The delay duration determines how long a course will be excepted from being processed again in either of the cases.'; +$string['config_backup_path'] = 'Path of the lifecycle backup folder'; +$string['config_backup_path_desc'] = 'This settings defines the storage location of the backups created by the backup step. +The path has to be specified as an absolute path on your server.'; $string['active_processes_list_header'] = 'Active processes'; $string['adminsettings_heading'] = 'Workflow settings'; $string['active_manual_workflows_heading'] = 'Active manual workflows'; diff --git a/settings.php b/settings.php index f2da89cf7b840d27d65912c972d81a1b4d878900..c4dd329b6310af7d248c621690582999ed688711 100644 --- a/settings.php +++ b/settings.php @@ -38,6 +38,11 @@ if ($hassiteconfig) { get_string('config_delay_duration_desc', 'tool_lifecycle'), 183 * 24 * 60 * 60)); // Dafault value is 180 days. + $settings->add(new admin_setting_configtext('tool_lifecycle/backup_path', + get_string('config_backup_path', 'tool_lifecycle'), + get_string('config_backup_path_desc', 'tool_lifecycle'), + $CFG->dataroot . DIRECTORY_SEPARATOR . 'lifecycle_backups')); + $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_active_processes()); $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_course_backups()); $ADMIN->add('lifecycle_category', new tool_lifecycle\admin_page_sublugins()); diff --git a/version.php b/version.php index 3e1554fcbe79457f78d317de1f346e5c62ff1bde..b97f25a0750dfb1969d62425b73d92d80627a0e7 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die; $plugin->maturity = MATURITY_BETA; -$plugin->version = 2019120200; +$plugin->version = 2019120201; $plugin->component = 'tool_lifecycle'; $plugin->requires = 2017111300; // Require Moodle 3.4 (or above). $plugin->release = 'v3.8-r1';