Skip to content

Commit

Permalink
Move backgroundjob script after main core scripts
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Dec 3, 2021
1 parent 71b18fc commit b0db309
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/private/legacy/OC_Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,9 @@ public function __construct($app, $name, $renderAs = TemplateResponse::RENDER_AS
public static function initTemplateEngine($renderAs) {
if (self::$initTemplateEngineFirstRun) {

//apps that started before the template initialization can load their own scripts/styles
//so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
//meaning the last script/style in this list will be loaded first
if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== TemplateResponse::RENDER_AS_ERROR && !\OCP\Util::needUpgrade()) {
if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
OC_Util::addScript('core', 'backgroundjobs', true);
}
}
// apps that started before the template initialization can load their own scripts/styles
// so to make sure this scripts/styles here are loaded first we put all core scripts first
// check lib/public/Util.php
OC_Util::addStyle('css-variables', null, true);
OC_Util::addStyle('server', null, true);

Expand All @@ -124,6 +119,15 @@ public static function initTemplateEngine($renderAs) {
Util::addScript('core', 'merged-template-prepend');
}

// If installed and background job is set to ajax, add dedicated script
if (\OC::$server->getSystemConfig()->getValue('installed', false)
&& $renderAs !== TemplateResponse::RENDER_AS_ERROR
&& !\OCP\Util::needUpgrade()) {
if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
Util::addScript('core', 'backgroundjobs');
}
}

self::$initTemplateEngineFirstRun = false;
}
}
Expand Down

0 comments on commit b0db309

Please sign in to comment.