Permalink
Browse files

Merge branch 'MDL-59431' of git://github.com/timhunt/moodle

  • Loading branch information...
dmonllao committed Jul 11, 2017
2 parents 93f2056 + 39c40ad commit f9384568352a4d5195ab3436484ce10c20e41472
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/requirejs.php
@@ -97,7 +97,12 @@
$content = '';
foreach ($jsfiles as $modulename => $jsfile) {
$js = file_get_contents($jsfile) . "\n";
$js = file_get_contents($jsfile);
if ($jsfile === false) {
error_log('Failed to load JavaScript file ' . $jsfile);
$js = '/* Failed to load JavaScript file ' . $jsfile . '. */';
}
$js .= "\n";
// Inject the module name into the define.
$replace = 'define(\'' . $modulename . '\', ';
$search = 'define(';
@@ -134,7 +139,7 @@
if (strpos($js, $search) === false) {
// We can't call debugging because we only have minimal config loaded.
header('HTTP/1.0 500 error');
die('JS file: ' . $shortfilename . ' does not contain a javascript module in AMD format. "define()" not found.');
die('JS file: ' . $shortfilename . ' cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found.');
}
// Replace only the first occurrence.

0 comments on commit f938456

Please sign in to comment.