diff options
author | Julius Knorr <jus@bitgrid.net> | 2024-09-17 22:38:44 +0200 |
---|---|---|
committer | Julius Knorr <jus@bitgrid.net> | 2024-09-20 14:53:34 +0200 |
commit | 606241caebda2e01702c0d08adbc35ace8d01f13 (patch) | |
tree | da9cc49d1079724a9192f89415c594b97db93aa9 /lib/private/legacy | |
parent | 7ff911665e7507a800e05fe9cd80e0304cd11dbc (diff) | |
download | nextcloud-server-clean/version-ocp.tar.gz nextcloud-server-clean/version-ocp.zip |
chore(legacy): Introduce public version ct plass and drop version methods from OC_Utilclean/version-ocp
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/OC_Defaults.php | 9 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 84 |
2 files changed, 7 insertions, 86 deletions
diff --git a/lib/private/legacy/OC_Defaults.php b/lib/private/legacy/OC_Defaults.php index cc0ac687ccc..f7015a1863a 100644 --- a/lib/private/legacy/OC_Defaults.php +++ b/lib/private/legacy/OC_Defaults.php @@ -6,6 +6,10 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +use OCP\IConfig; +use OCP\Server; +use OCP\ServerVersion; + class OC_Defaults { private $theme; @@ -27,7 +31,8 @@ class OC_Defaults { private $defaultProductName; public function __construct() { - $config = \OC::$server->getConfig(); + $config = Server::get(IConfig::class); + $serverVersion = Server::get(ServerVersion::class); $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */ @@ -39,7 +44,7 @@ class OC_Defaults { $this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client'); $this->defaultFDroidClientUrl = $config->getSystemValue('customclient_fdroid', 'https://f-droid.org/packages/com.nextcloud.client/'); $this->defaultDocBaseUrl = 'https://docs.nextcloud.com'; - $this->defaultDocVersion = \OC_Util::getVersion()[0]; // used to generate doc links + $this->defaultDocVersion = $serverVersion->getMajorVersion(); // used to generate doc links $this->defaultColorBackground = '#00679e'; $this->defaultColorPrimary = '#00679e'; $this->defaultTextColorPrimary = '#ffffff'; diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index c390b7727e9..7b41f797e32 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -216,76 +216,6 @@ class OC_Util { } /** - * get the current installed version of ownCloud - * - * @return array - */ - public static function getVersion() { - OC_Util::loadVersion(); - return self::$versionCache['OC_Version']; - } - - /** - * get the current installed version string of ownCloud - * - * @return string - */ - public static function getVersionString() { - OC_Util::loadVersion(); - return self::$versionCache['OC_VersionString']; - } - - /** - * @deprecated 11.0.0 the value is of no use anymore - * @return string - */ - public static function getEditionString() { - return ''; - } - - /** - * @description get the update channel of the current installed of ownCloud. - * @return string - */ - public static function getChannel() { - OC_Util::loadVersion(); - return \OC::$server->getConfig()->getSystemValueString('updater.release.channel', self::$versionCache['OC_Channel']); - } - - /** - * @description get the build number of the current installed of ownCloud. - * @return string - */ - public static function getBuild() { - OC_Util::loadVersion(); - return self::$versionCache['OC_Build']; - } - - /** - * @description load the version.php into the session as cache - * @suppress PhanUndeclaredVariable - */ - private static function loadVersion() { - if (self::$versionCache !== null) { - return; - } - - $timestamp = filemtime(OC::$SERVERROOT . '/version.php'); - require OC::$SERVERROOT . '/version.php'; - /** @var int $timestamp */ - self::$versionCache['OC_Version_Timestamp'] = $timestamp; - /** @var string $OC_Version */ - self::$versionCache['OC_Version'] = $OC_Version; - /** @var string $OC_VersionString */ - self::$versionCache['OC_VersionString'] = $OC_VersionString; - /** @var string $OC_Build */ - self::$versionCache['OC_Build'] = $OC_Build; - - /** @var string $OC_Channel */ - self::$versionCache['OC_Channel'] = $OC_Channel; - } - - /** * generates a path for JS/CSS files. If no application is provided it will create the path for core. * * @param string $application application to get the files from @@ -1022,20 +952,6 @@ class OC_Util { } /** - * A human readable string is generated based on version and build number - * - * @return string - */ - public static function getHumanVersion() { - $version = OC_Util::getVersionString(); - $build = OC_Util::getBuild(); - if (!empty($build) and OC_Util::getChannel() === 'daily') { - $version .= ' Build:' . $build; - } - return $version; - } - - /** * Check whether the instance needs to perform an upgrade, * either when the core version is higher or any app requires * an upgrade. |