Now the destination directory in scheduled bakups have some checks:
- Trailing slashes. - Trailing backslashes. - Exists.
This commit is contained in:
+22
-3
@@ -14,10 +14,27 @@
|
||||
error("Site isn't defined!");
|
||||
}
|
||||
|
||||
//Initialise error variables
|
||||
$error = false;
|
||||
$sche_destination_error = "";
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($config = data_submitted()) {
|
||||
|
||||
//First of all we check that everything is correct
|
||||
//Check for trailing slash and backslash in backup_sche_destination
|
||||
if (!empty($backup_sche_destination) and
|
||||
(substr($backup_sche_destination,-1) == "/" or substr($backup_sche_destination,-1) == "\\")) {
|
||||
$error = true;
|
||||
$sche_destination_error = get_string("pathslasherror");
|
||||
//Now check that backup_sche_destination dir exists
|
||||
} else if (!empty($backup_sche_destination) and
|
||||
!is_dir($backup_sche_destination)) {
|
||||
$error = true;
|
||||
$sche_destination_error = get_string("pathnotexists");
|
||||
}
|
||||
|
||||
//We need to do some weekdays conversions prior to continue
|
||||
$i = 0;
|
||||
$temp = "";
|
||||
@@ -40,8 +57,10 @@
|
||||
foreach ($config as $name => $value) {
|
||||
backup_set_config($name, $value);
|
||||
}
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
|
||||
exit;
|
||||
if (!$error) {
|
||||
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/// Otherwise print the form.
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@
|
||||
</tr>
|
||||
<tr valign=top>
|
||||
<td colspan = 3 align=center>
|
||||
<?php print_string("saveto") ?>: <input name="backup_sche_destination" type="text" size="40" value="<?php p($backup_config->backup_sche_destination) ?>"><br><?php print_string("backupsavetohelp") ?>
|
||||
<?php print_string("saveto") ?>: <input name="backup_sche_destination" type="text" size="40" value="<?php p($backup_config->backup_sche_destination) ?>"><br><?php if (!empty($sche_destination_error)) { formerr($sche_destination_error); echo "<br>"; } ?><?php print_string("backupsavetohelp") ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user