diff --git a/modules/core/output_modules.php b/modules/core/output_modules.php
index 0354f9cd16..c745a67b3d 100644
--- a/modules/core/output_modules.php
+++ b/modules/core/output_modules.php
@@ -561,11 +561,9 @@ protected function output() {
$mod = str_replace(array('modules', DIRECTORY_SEPARATOR), '', $rel_name);
if (in_array($mod, $mods, true) && is_readable(sprintf("%ssite.js", $name))) {
$res .= '';
- $res .= '';
}
- $res .= '';
}
}
if ($core) {
diff --git a/scripts/config_gen.php b/scripts/config_gen.php
index ae703527d6..2299c9ecdd 100644
--- a/scripts/config_gen.php
+++ b/scripts/config_gen.php
@@ -183,9 +183,12 @@ function get_module_assignments($settings) {
$mods = get_modules($settings);
foreach ($mods as $mod) {
printf("scanning module %s ...\n", $mod);
- if (is_readable(sprintf("modules/%s/site.js", $mod))) {
- $js .= str_replace("'use strict';", '', file_get_contents(sprintf("modules/%s/site.js", $mod)));
+ foreach (glob('modules' . DIRECTORY_SEPARATOR . $mod . DIRECTORY_SEPARATOR . 'js_modules' . DIRECTORY_SEPARATOR . '*.js') as $js_module) {
+ $js .= file_get_contents($js_module);
}
+ if (is_readable(sprintf("modules/%s/site.js", $mod))) {
+ $js .= str_replace("'use strict';", '', file_get_contents(sprintf("modules/%s/site.js", $mod)));
+ }
if (is_readable(sprintf("modules/%s/site.css", $mod))) {
$css .= file_get_contents(sprintf("modules/%s/site.css", $mod));
}
diff --git a/tests/phpunit/modules/core/output_modules_debug.php b/tests/phpunit/modules/core/output_modules_debug.php
index 14ae83e486..72087b7376 100644
--- a/tests/phpunit/modules/core/output_modules_debug.php
+++ b/tests/phpunit/modules/core/output_modules_debug.php
@@ -30,7 +30,7 @@ public function test_page_js_debug() {
$this->assertEquals(array(''), $res->output_response);
$test->handler_response = array('encrypt_ajax_requests' => true, 'router_module_list' => array('imap'));
$res = $test->run();
- $this->assertEquals(array(''), $res->output_response);
+ $this->assertEquals(array(''), $res->output_response);
}
/**
* @preserveGlobalState disabled