Skip to content

Commit b5ce31e

Browse files
committed
bugfix: handle mobile fonts better
1 parent 68e4add commit b5ce31e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

classes/local/bundled_mobile_handler.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ private function ensure_h5p_core_fonts_stored() {
283283

284284
$corefonts = [
285285
'h5p-core-28.ttf',
286+
'h5p-core-29.ttf',
287+
'h5p-core-30.ttf',
286288
];
287289

288290
$fs = get_file_storage();
@@ -299,11 +301,18 @@ private function ensure_h5p_core_fonts_stored() {
299301

300302
if ($fs->file_exists($record->contextid, $record->component, $record->filearea, $record->itemid,
301303
$record->filepath, $record->filename)) {
302-
return;
304+
continue;
305+
}
306+
307+
$filepath = $CFG->dirroot . '/mod/hvp/library/fonts/' . $font;
308+
309+
// If file itself doesn't exist, skip (likely, the library has updated or renamed the font).
310+
if (!file_exists($filepath)) {
311+
continue;
303312
}
304313

305314
// Else store file.
306-
$fs->create_file_from_pathname($record, $CFG->dirroot . '/mod/hvp/library/fonts/' . $font);
315+
$fs->create_file_from_pathname($record, $filepath);
307316
}
308317
}
309318

0 commit comments

Comments
 (0)