Remove unused require_once, die if touch fails

This commit is contained in:
Kumi 2022-01-13 17:17:48 +01:00
parent 4f62900be1
commit d44854e07b

View file

@ -1,6 +1,5 @@
<?php <?php
require_once("../../config.php"); require_once("../../config.php");
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
if (! function_exists('str_ends_with')) { if (! function_exists('str_ends_with')) {
function str_ends_with(string $haystack, string $needle): bool function str_ends_with(string $haystack, string $needle): bool
@ -24,4 +23,6 @@ if (!has_capability('local/replication:replicate', $context)) {
die("User not allowed to trigger replication!"); die("User not allowed to trigger replication!");
} }
touch($directory . $id . "-" . $course->category . ".mew"); if (!touch($directory . $id . "-" . $course->category . ".mew")) {
die("Could not touch $directory$id-{$course->category}.mew");
}