aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-08-17 11:18:26 +0200
committerRobin Appelman <robin@icewind.nl>2023-08-17 11:18:26 +0200
commit1df33256be6d503e5952091be1f80004a49730e0 (patch)
tree74470df5179a2b91a4abc1e6469e9bf009324d6d
parent37e3115cb472a8d8b16be183c045220835e1fbef (diff)
downloadnextcloud-server-1df33256be6d503e5952091be1f80004a49730e0.tar.gz
nextcloud-server-1df33256be6d503e5952091be1f80004a49730e0.zip
add core fileclient script before others
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--core/Listener/BeforeTemplateRenderedListener.php6
-rw-r--r--lib/public/Util.php9
2 files changed, 10 insertions, 5 deletions
diff --git a/core/Listener/BeforeTemplateRenderedListener.php b/core/Listener/BeforeTemplateRenderedListener.php
index 95adfc61ad9..0eff47449c7 100644
--- a/core/Listener/BeforeTemplateRenderedListener.php
+++ b/core/Listener/BeforeTemplateRenderedListener.php
@@ -62,9 +62,9 @@ class BeforeTemplateRenderedListener implements IEventListener {
Util::addTranslations('core');
if ($event->getResponse()->getRenderAs() !== TemplateResponse::RENDER_AS_ERROR) {
- Util::addScript('core', 'files_fileinfo');
- Util::addScript('core', 'files_client');
- Util::addScript('core', 'merged-template-prepend');
+ Util::addScript('core', 'merged-template-prepend', 'core', true);
+ Util::addScript('core', 'files_client', 'core', true);
+ Util::addScript('core', 'files_fileinfo', 'core', true);
// If installed and background job is set to ajax, add dedicated script
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 1d03c35a9b7..bff8038b3dd 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -169,9 +169,10 @@ class Util {
* @param string $application
* @param string|null $file
* @param string $afterAppId
+ * @param bool $prepend
* @since 4.0.0
*/
- public static function addScript(string $application, string $file = null, string $afterAppId = 'core'): void {
+ public static function addScript(string $application, string $file = null, string $afterAppId = 'core', bool $prepend = false): void {
if (!empty($application)) {
$path = "$application/js/$file";
} else {
@@ -194,7 +195,11 @@ class Util {
self::$scriptDeps[$application]->addDep($afterAppId);
}
- self::$scripts[$application][] = $path;
+ if ($prepend) {
+ array_unshift(self::$scripts[$application], $path);
+ } else {
+ self::$scripts[$application][] = $path;
+ }
}
/**