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(),
);
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),
// 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();
}
// 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
\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']);
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)) {
}
$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');
$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)) {
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.',
* @return string
*/
public function getOcVersion() {
- $v = OC_Util::getVersion();
+ $v = \OCP\Util::getVersion();
return join('.', $v);
}
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 */
\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']);
}
// 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"));
}
\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, '>')) {
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,
'datadirectory' => $dataDir,
'overwrite.cli.url' => $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT,
'dbtype' => $dbType,
- 'version' => implode('.', \OC_Util::getVersion()),
+ 'version' => implode('.', \OCP\Util::getVersion()),
]);
try {
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));
}
$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();
}
$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;
}
// 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()));
}
}
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
*/
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;
}
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;
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);
}
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'];
$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'];
$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) {
* @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';
}
/**
*/
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));
$result = \OC_Util::checkServer($this->getConfig(array(
'installed' => true,
- 'version' => implode('.', OC_Util::getVersion())
+ 'version' => implode('.', \OCP\Util::getVersion())
)));
$this->assertCount(1, $result);
}
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);
}
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);
}
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);