diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-04-01 15:04:41 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-04-01 15:24:24 +0200 |
commit | e467ea1c6a1c21a514963cf7aef78681f41ce35b (patch) | |
tree | 94bff2fcf9def0a336d3011a399b9b3b364a00f0 /lib | |
parent | b03ffab5f0f39139c71cb2b8c370ca3f3d1ad391 (diff) | |
download | nextcloud-server-feat/cleanup-oc-util.tar.gz nextcloud-server-feat/cleanup-oc-util.zip |
chore(legacy): Remove deprecated OC_Util::addScript and functions depending on itfeat/cleanup-oc-util
Deprecated since 24, currently unused.
Sadly not all related functions were officially marked as deprecated,
but all of them were unused.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Template/functions.php | 18 | ||||
-rw-r--r-- | lib/private/TemplateLayout.php | 3 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 63 |
3 files changed, 2 insertions, 82 deletions
diff --git a/lib/private/Template/functions.php b/lib/private/Template/functions.php index 957aaee2237..77a1e831008 100644 --- a/lib/private/Template/functions.php +++ b/lib/private/Template/functions.php @@ -123,22 +123,6 @@ function script($app, $file = null): void { } /** - * Shortcut for adding vendor scripts to a page - * @param string $app the appname - * @param string|string[] $file the filename, - * if an array is given it will add all scripts - */ -function vendor_script($app, $file = null): void { - if (is_array($file)) { - foreach ($file as $f) { - OC_Util::addVendorScript($app, $f); - } - } else { - OC_Util::addVendorScript($app, $file); - } -} - -/** * Shortcut for adding styles to a page * @param string $app the appname * @param string|string[] $file the filename, @@ -176,7 +160,7 @@ function vendor_style($app, $file = null): void { * if an array is given it will add all styles */ function translation($app): void { - OC_Util::addTranslations($app); + Util::addTranslations($app); } /** diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 01d22edc0fb..b109d023ca3 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -214,8 +214,7 @@ class TemplateLayout { } // Add the js files - // TODO: remove deprecated OC_Util injection - $jsFiles = self::findJavascriptFiles(array_merge(\OC_Util::$scripts, Util::getScripts())); + $jsFiles = self::findJavascriptFiles(Util::getScripts()); $page->assign('jsfiles', []); if ($this->config->getSystemValueBool('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_Util.php b/lib/private/legacy/OC_Util.php index 36a121094cc..b2950275e41 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -20,7 +20,6 @@ use OCP\Share\IManager; use Psr\Log\LoggerInterface; class OC_Util { - public static $scripts = []; public static $styles = []; public static $headers = []; @@ -236,60 +235,6 @@ class OC_Util { } /** - * add a javascript file - * - * @deprecated 24.0.0 - Use \OCP\Util::addScript - * - * @param string $application application id - * @param string|null $file filename - * @param bool $prepend prepend the Script to the beginning of the list - * @return void - */ - public static function addScript($application, $file = null, $prepend = false) { - $path = OC_Util::generatePath($application, 'js', $file); - - // core js files need separate handling - if ($application !== 'core' && $file !== null) { - self::addTranslations($application); - } - self::addExternalResource($application, $prepend, $path, 'script'); - } - - /** - * add a javascript file from the vendor sub folder - * - * @param string $application application id - * @param string|null $file filename - * @param bool $prepend prepend the Script to the beginning of the list - * @return void - */ - public static function addVendorScript($application, $file = null, $prepend = false) { - $path = OC_Util::generatePath($application, 'vendor', $file); - self::addExternalResource($application, $prepend, $path, 'script'); - } - - /** - * add a translation JS file - * - * @deprecated 24.0.0 - * - * @param string $application application id - * @param string|null $languageCode language code, defaults to the current language - * @param bool|null $prepend prepend the Script to the beginning of the list - */ - public static function addTranslations($application, $languageCode = null, $prepend = false) { - if (is_null($languageCode)) { - $languageCode = \OC::$server->get(IFactory::class)->findLanguage($application); - } - if (!empty($application)) { - $path = "$application/l10n/$languageCode"; - } else { - $path = "l10n/$languageCode"; - } - self::addExternalResource($application, $prepend, $path, 'script'); - } - - /** * add a css file * * @param string $application application id @@ -333,14 +278,6 @@ class OC_Util { self::$styles[] = $path; } } - } elseif ($type === 'script') { - if (!in_array($path, self::$scripts)) { - if ($prepend === true) { - array_unshift(self::$scripts, $path); - } else { - self::$scripts [] = $path; - } - } } } |