diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-12-02 18:57:11 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2022-01-08 10:14:50 +0100 |
commit | 87d0904b6f6209a553efd5d405c917012a91e259 (patch) | |
tree | 8f5d1c53a68cd192fa3b318c63eba0b9108b40a0 /lib | |
parent | 74b980310852a0b406fa9d073870f92c409d5444 (diff) | |
download | nextcloud-server-87d0904b6f6209a553efd5d405c917012a91e259.tar.gz nextcloud-server-87d0904b6f6209a553efd5d405c917012a91e259.zip |
Split common vendor chunk
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/TemplateLayout.php | 3 | ||||
-rw-r--r-- | lib/private/legacy/OC_Template.php | 14 | ||||
-rw-r--r-- | lib/private/legacy/template/functions.php | 13 |
3 files changed, 21 insertions, 9 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index f5109c678fd..9cfc1aec6dd 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -209,7 +209,8 @@ class TemplateLayout extends \OC_Template { } // Add the js files - $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts); + // TODO: remove deprecated OC_Util injection + $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); $this->assign('jsfiles', []); if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) { // this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call) diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 61fc82dacbb..dcca41fb1d0 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -39,6 +39,7 @@ */ use OC\TemplateLayout; use OCP\AppFramework\Http\TemplateResponse; +use OCP\Util; require_once __DIR__.'/template/functions.php'; @@ -111,14 +112,17 @@ class OC_Template extends \OC\Template\Base { } OC_Util::addStyle('css-variables', null, true); OC_Util::addStyle('server', null, true); - OC_Util::addTranslations('core', null, true); + + // include common nextcloud webpack bundle + Util::addScript('core', 'common'); + Util::addScript('core', 'main'); + Util::addTranslations('core'); if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) { - OC_Util::addScript('core', 'merged-template-prepend', true); - OC_Util::addScript('core', 'files_client', true); - OC_Util::addScript('core', 'files_fileinfo', true); + Util::addScript('core', 'files_fileinfo'); + Util::addScript('core', 'files_client'); + Util::addScript('core', 'merged-template-prepend'); } - OC_Util::addScript('core', 'main', true); self::$initTemplateEngineFirstRun = false; } diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 6b18c9476b4..1b554c2329e 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -1,4 +1,7 @@ <?php + +use OCP\Util; + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -111,17 +114,21 @@ function print_unescaped($string) { /** * Shortcut for adding scripts to a page + * All scripts are forced to be loaded after core since + * they are coming from a template registration. + * Please consider moving them into the relevant controller + * * @param string $app the appname * @param string|string[] $file the filename, * if an array is given it will add all scripts */ function script($app, $file = null) { if (is_array($file)) { - foreach ($file as $f) { - OC_Util::addScript($app, $f); + foreach ($file as $script) { + Util::addScript($app, $script, 'core'); } } else { - OC_Util::addScript($app, $file); + Util::addScript($app, $file, 'core'); } } |