diff --git a/core/command/status.php b/core/command/status.php index 2eb58525d3ea34e165de71c142049d930d3abe0a..c2a28ff822fb72870cbbb4a61e19fce1a5120290 100644 --- a/core/command/status.php +++ b/core/command/status.php @@ -39,7 +39,7 @@ class Status extends Base { protected function execute(InputInterface $input, OutputInterface $output) { $values = array( 'installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), - 'version' => implode('.', \OC_Util::getVersion()), + 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => \OC_Util::getVersionString(), 'edition' => \OC_Util::getEditionString(), ); diff --git a/core/js/config.php b/core/js/config.php index e51ae903729672c20aff02ec204aab040e8fbaa1..c975c6db2dc27365e2b43fe46b3d6d8aa122fad6 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -138,7 +138,7 @@ $array = array( array( 'session_lifetime' => min(\OCP\Config::getSystemValue('session_lifetime', OC::$server->getIniWrapper()->getNumeric('session.gc_maxlifetime')), OC::$server->getIniWrapper()->getNumeric('session.gc_maxlifetime')), 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true), - 'version' => implode('.', OC_Util::getVersion()), + 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => OC_Util::getVersionString(), 'enable_avatars' => \OC::$server->getConfig()->getSystemValue('enable_avatars', true), 'lost_password_link'=> \OC::$server->getConfig()->getSystemValue('lost_password_link', null), diff --git a/lib/base.php b/lib/base.php index c0db0454f6adc9f3745cfc355c1dc66ba595b917..ce4546e8fa3dd40e080479aa9f9e1f2e7fcd97f5 100644 --- a/lib/base.php +++ b/lib/base.php @@ -377,7 +377,7 @@ class OC { // check whether this is a core update or apps update $installedVersion = $systemConfig->getValue('version', '0.0.0'); - $currentVersion = implode('.', OC_Util::getVersion()); + $currentVersion = implode('.', \OCP\Util::getVersion()); $appManager = \OC::$server->getAppManager(); @@ -392,7 +392,7 @@ class OC { } // get third party apps - $ocVersion = OC_Util::getVersion(); + $ocVersion = \OCP\Util::getVersion(); $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion)); $tmpl->assign('productName', 'ownCloud'); // for now diff --git a/lib/private/app.php b/lib/private/app.php index ff711e82424042c9f8b73d9f89add3d04889fe3a..5f6ca9596c87b073ca26e9943ff6ed834b8cbf92 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -318,8 +318,8 @@ class OC_App { \OC::$server->getConfig(), \OC::$server->getLogger() ); - $appData = $ocsClient->getApplication($app, \OC_Util::getVersion()); - $download= $ocsClient->getApplicationDownload($app, \OC_Util::getVersion()); + $appData = $ocsClient->getApplication($app, \OCP\Util::getVersion()); + $download= $ocsClient->getApplicationDownload($app, \OCP\Util::getVersion()); if(isset($download['downloadlink']) and $download['downloadlink']!='') { // Replace spaces in download link without encoding entire URL $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -880,7 +880,7 @@ class OC_App { if (is_null($category)) { - $categoryNames = $ocsClient->getCategories(\OC_Util::getVersion()); + $categoryNames = $ocsClient->getCategories(\OCP\Util::getVersion()); if (is_array($categoryNames)) { // Check that categories of apps were retrieved correctly if (!$categories = array_keys($categoryNames)) { @@ -892,7 +892,7 @@ class OC_App { } $page = 0; - $remoteApps = $ocsClient->getApplications($categories, $page, $filter, \OC_Util::getVersion()); + $remoteApps = $ocsClient->getApplications($categories, $page, $filter, \OCP\Util::getVersion()); $apps = []; $i = 0; $l = \OC::$server->getL10N('core'); @@ -1050,7 +1050,7 @@ class OC_App { $config, \OC::$server->getLogger() ); - $appData = $ocsClient->getApplication($app, \OC_Util::getVersion()); + $appData = $ocsClient->getApplication($app, \OCP\Util::getVersion()); // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string if (!is_numeric($app)) { @@ -1080,7 +1080,7 @@ class OC_App { if ($app !== false) { // check if the app is compatible with this version of ownCloud $info = self::getAppInfo($app); - $version = OC_Util::getVersion(); + $version = \OCP\Util::getVersion(); if (!self::isAppCompatible($version, $info)) { throw new \Exception( $l->t('App "%s" cannot be installed because it is not compatible with this version of ownCloud.', diff --git a/lib/private/app/platform.php b/lib/private/app/platform.php index f433ecd9f9e9c0bcd4a8318730abb424c4b9f24a..c16f050e13c4b2c0841fb34eb64b262ced07b266 100644 --- a/lib/private/app/platform.php +++ b/lib/private/app/platform.php @@ -52,7 +52,7 @@ class Platform { * @return string */ public function getOcVersion() { - $v = OC_Util::getVersion(); + $v = \OCP\Util::getVersion(); return join('.', $v); } diff --git a/lib/private/defaults.php b/lib/private/defaults.php index 16f45943f54cba1f7ff55e2acb006422cb5c1f67..23f0baad96ec3efbd06ce82f13631eebe7e23944 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -49,7 +49,7 @@ class OC_Defaults { function __construct() { $this->l = \OC::$server->getL10N('lib'); - $version = OC_Util::getVersion(); + $version = \OCP\Util::getVersion(); $this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */ $this->defaultName = 'ownCloud'; /* short name, used when referring to the software */ diff --git a/lib/private/installer.php b/lib/private/installer.php index e1447db0db51593f18236da05649dbc950b5f5a0..bbd976cda91f98b7b7915ab4fc95360c43c372ec 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -232,8 +232,8 @@ class OC_Installer{ \OC::$server->getConfig(), \OC::$server->getLogger() ); - $appData = $ocsClient->getApplication($ocsId, \OC_Util::getVersion()); - $download = $ocsClient->getApplicationDownload($ocsId, \OC_Util::getVersion()); + $appData = $ocsClient->getApplication($ocsId, \OCP\Util::getVersion()); + $download = $ocsClient->getApplicationDownload($ocsId, \OCP\Util::getVersion()); if (isset($download['downloadlink']) && trim($download['downloadlink']) !== '') { $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -342,7 +342,7 @@ class OC_Installer{ } // check if the app is compatible with this version of ownCloud - if(!OC_App::isAppCompatible(OC_Util::getVersion(), $info)) { + if(!OC_App::isAppCompatible(\OCP\Util::getVersion(), $info)) { OC_Helper::rmdirr($extractDir); throw new \Exception($l->t("App can't be installed because it is not compatible with this version of ownCloud")); } @@ -400,7 +400,7 @@ class OC_Installer{ \OC::$server->getConfig(), \OC::$server->getLogger() ); - $ocsdata = $ocsClient->getApplication($ocsid, \OC_Util::getVersion()); + $ocsdata = $ocsClient->getApplication($ocsid, \OCP\Util::getVersion()); $ocsversion= (string) $ocsdata['version']; $currentversion=OC_App::getAppVersion($app); if (version_compare($ocsversion, $currentversion, '>')) { diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index 2cf40c449ffb214ef7b4dd441f0e68c7edb714fd..1b04f43d4771b5d0b7b77886d73bfbf0c8609d43 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -26,7 +26,7 @@ class OC_OCS_Cloud { public static function getCapabilities() { $result = array(); - list($major, $minor, $micro) = OC_Util::getVersion(); + list($major, $minor, $micro) = \OCP\Util::getVersion(); $result['version'] = array( 'major' => $major, 'minor' => $minor, diff --git a/lib/private/setup.php b/lib/private/setup.php index 4d11cb44a83af09a181cae33a482804d7cd6348a..770f5cdab523d2ad2d3dd1b96c3a2f22719247ca 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -322,7 +322,7 @@ class Setup { 'datadirectory' => $dataDir, 'overwrite.cli.url' => $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT, 'dbtype' => $dbType, - 'version' => implode('.', \OC_Util::getVersion()), + 'version' => implode('.', \OCP\Util::getVersion()), ]); try { diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index 95688268c47985aafc93f4907c2f39b15c426aa7..bf25b2d31a97acaed9aa19e4c689742b39fec31a 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/templatelayout.php @@ -159,7 +159,7 @@ class OC_TemplateLayout extends OC_Template { if(empty(self::$versionHash)) { $v = OC_App::getAppVersions(); - $v['core'] = implode('.', \OC_Util::getVersion()); + $v['core'] = implode('.', \OCP\Util::getVersion()); self::$versionHash = md5(implode(',', $v)); } diff --git a/lib/private/updater.php b/lib/private/updater.php index d5598d339d3d83a0239ed5f9bfebda70718d4052..04f8dcf72263758e020097e302192d788a0ee288 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -155,7 +155,7 @@ class Updater extends BasicEmitter { $this->config->setAppValue('core', 'installedat', microtime(true)); } - $version = \OC_Util::getVersion(); + $version = \OCP\Util::getVersion(); $version['installed'] = $this->config->getAppValue('core', 'installedat'); $version['updated'] = $this->config->getAppValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); @@ -208,7 +208,7 @@ class Updater extends BasicEmitter { } $installedVersion = $this->config->getSystemValue('version', '0.0.0'); - $currentVersion = implode('.', \OC_Util::getVersion()); + $currentVersion = implode('.', \OCP\Util::getVersion()); $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); $success = true; @@ -353,7 +353,7 @@ class Updater extends BasicEmitter { } // only set the final version if everything went well - $this->config->setSystemValue('version', implode('.', \OC_Util::getVersion())); + $this->config->setSystemValue('version', implode('.', \OCP\Util::getVersion())); } } @@ -472,7 +472,7 @@ class Updater extends BasicEmitter { private function checkAppsRequirements() { $isCoreUpgrade = $this->isCodeUpgrade(); $apps = OC_App::getEnabledApps(); - $version = OC_Util::getVersion(); + $version = \OCP\Util::getVersion(); $disabledApps = []; foreach ($apps as $app) { // check if the app is compatible with this version of ownCloud @@ -509,7 +509,7 @@ class Updater extends BasicEmitter { */ private function isCodeUpgrade() { $installedVersion = $this->config->getSystemValue('version', '0.0.0'); - $currentVersion = implode('.', OC_Util::getVersion()); + $currentVersion = implode('.', \OCP\Util::getVersion()); if (version_compare($currentVersion, $installedVersion, '>')) { return true; } diff --git a/lib/private/util.php b/lib/private/util.php index 0e029d74b7d0d8feafe69fc3d3cedd4bef02004c..12146f6980bb89ccc4d6dbc588b5a79201d9c521 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1509,7 +1509,7 @@ class OC_Util { public static function needUpgrade(\OCP\IConfig $config) { if ($config->getSystemValue('installed', false)) { $installedVersion = $config->getSystemValue('version', '0.0.0'); - $currentVersion = implode('.', OC_Util::getVersion()); + $currentVersion = implode('.', \OCP\Util::getVersion()); $versionDiff = version_compare($currentVersion, $installedVersion); if ($versionDiff > 0) { return true; diff --git a/settings/controller/appsettingscontroller.php b/settings/controller/appsettingscontroller.php index d0e465bfa9c14e465b9b56bd4e674fd6cc174ea1..d2430f9b5599d5be04e2aae57a2c077afe592682 100644 --- a/settings/controller/appsettingscontroller.php +++ b/settings/controller/appsettingscontroller.php @@ -159,7 +159,7 @@ class AppSettingsController extends Controller { if($this->ocsClient->isAppStoreEnabled()) { // apps from external repo via OCS - $ocs = $this->ocsClient->getCategories(\OC_Util::getVersion()); + $ocs = $this->ocsClient->getCategories(\OCP\Util::getVersion()); if ($ocs) { foreach($ocs as $k => $v) { $name = str_replace('ownCloud ', '', $v); @@ -205,9 +205,10 @@ class AppSettingsController extends Controller { } return ($a < $b) ? -1 : 1; }); + $version = \OCP\Util::getVersion(); foreach($apps as $key => $app) { if(!array_key_exists('level', $app) && array_key_exists('ocsid', $app)) { - $remoteAppEntry = $this->ocsClient->getApplication($app['ocsid'], \OC_Util::getVersion()); + $remoteAppEntry = $this->ocsClient->getApplication($app['ocsid'], $version); if(is_array($remoteAppEntry) && array_key_exists('level', $remoteAppEntry)) { $apps[$key]['level'] = $remoteAppEntry['level']; @@ -221,9 +222,10 @@ class AppSettingsController extends Controller { $apps = array_filter($apps, function ($app) { return !$app['active']; }); + $version = \OCP\Util::getVersion(); foreach($apps as $key => $app) { if(!array_key_exists('level', $app) && array_key_exists('ocsid', $app)) { - $remoteAppEntry = $this->ocsClient->getApplication($app['ocsid'], \OC_Util::getVersion()); + $remoteAppEntry = $this->ocsClient->getApplication($app['ocsid'], $version); if(is_array($remoteAppEntry) && array_key_exists('level', $remoteAppEntry)) { $apps[$key]['level'] = $remoteAppEntry['level']; diff --git a/status.php b/status.php index f59dc16b6a2bba040ec6ab7329a7607bc45e3295..65418336e264f2a6c03065a87b9eddc914516d98 100644 --- a/status.php +++ b/status.php @@ -36,7 +36,7 @@ try { $values=array( 'installed'=>$installed, 'maintenance' => $maintenance, - 'version'=>implode('.', OC_Util::getVersion()), + 'version'=>implode('.', \OCP\Util::getVersion()), 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); if (OC::$CLI) { diff --git a/tests/lib/updater.php b/tests/lib/updater.php index 14ae3db3276bc2cd8e47e7f01150a8d8712039d5..313ffb65738680ae1b532ac9b6bd277e06d4423b 100644 --- a/tests/lib/updater.php +++ b/tests/lib/updater.php @@ -66,7 +66,7 @@ class UpdaterTest extends \Test\TestCase { * @return string */ private function buildUpdateUrl($baseUrl) { - return $baseUrl . '?version='.implode('x', \OC_Util::getVersion()).'xinstalledatxlastupdatedatx'.\OC_Util::getChannel().'x'.\OC_Util::getEditionString().'x'; + return $baseUrl . '?version='.implode('x', \OCP\Util::getVersion()).'xinstalledatxlastupdatedatx'.\OC_Util::getChannel().'x'.\OC_Util::getEditionString().'x'; } /** diff --git a/tests/lib/util.php b/tests/lib/util.php index fa559c17c8097661386e7d890edd42e5e65d40f1..cb5d28b48a7d039fd9810e7a85493849b618e8a8 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -8,7 +8,7 @@ */ class Test_Util extends \Test\TestCase { public function testGetVersion() { - $version = \OC_Util::getVersion(); + $version = \OCP\Util::getVersion(); $this->assertTrue(is_array($version)); foreach ($version as $num) { $this->assertTrue(is_int($num)); diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php index 64757d0acd97775afa00e10b13a0a7b276ff0460..94e7fd2f77970b5a2afb7dc84fbf114b11f8d66b 100644 --- a/tests/lib/utilcheckserver.php +++ b/tests/lib/utilcheckserver.php @@ -123,7 +123,7 @@ class Test_Util_CheckServer extends \Test\TestCase { $result = \OC_Util::checkServer($this->getConfig(array( 'installed' => true, - 'version' => implode('.', OC_Util::getVersion()) + 'version' => implode('.', \OCP\Util::getVersion()) ))); $this->assertCount(1, $result); } @@ -134,7 +134,7 @@ class Test_Util_CheckServer extends \Test\TestCase { public function testDataDirWritable() { $result = \OC_Util::checkServer($this->getConfig(array( 'installed' => true, - 'version' => implode('.', OC_Util::getVersion()) + 'version' => implode('.', \OCP\Util::getVersion()) ))); $this->assertEmpty($result); } @@ -150,7 +150,7 @@ class Test_Util_CheckServer extends \Test\TestCase { chmod($this->datadir, 0300); $result = \OC_Util::checkServer($this->getConfig(array( 'installed' => true, - 'version' => implode('.', OC_Util::getVersion()) + 'version' => implode('.', \OCP\Util::getVersion()) ))); $this->assertCount(1, $result); } @@ -162,7 +162,7 @@ class Test_Util_CheckServer extends \Test\TestCase { chmod($this->datadir, 0300); $result = \OC_Util::checkServer($this->getConfig(array( 'installed' => false, - 'version' => implode('.', OC_Util::getVersion()) + 'version' => implode('.', \OCP\Util::getVersion()) ))); chmod($this->datadir, 0700); //needed for cleanup $this->assertEmpty($result);