MDL-73030 backup: case-insensitive detection of Moodle backups.

This commit is contained in:
Paul Holden 2022-02-02 17:33:39 +00:00
parent 24f97edd91
commit 65f9976478

View file

@ -145,9 +145,11 @@ abstract class convert_helper {
$firstchars = fread($handle, 200); $firstchars = fread($handle, 200);
$status = fclose($handle); $status = fclose($handle);
if (strpos($firstchars,'<?xml version="1.0" encoding="UTF-8"?>') !== false and // Look for expected XML elements (case-insensitive to account for encoding attribute).
strpos($firstchars,'<moodle_backup>') !== false and if (stripos($firstchars, '<?xml version="1.0" encoding="UTF-8"?>') !== false &&
strpos($firstchars,'<information>') !== false) { strpos($firstchars, '<moodle_backup>') !== false &&
strpos($firstchars, '<information>') !== false) {
return true; return true;
} }