Signed-off-by: Julius Härtl <jus@bitgrid.net>tags/v17.0.0beta1
'micro' => $micro, | 'micro' => $micro, | ||||
'string' => \OC_Util::getVersionString(), | 'string' => \OC_Util::getVersionString(), | ||||
'edition' => '', | 'edition' => '', | ||||
'extendedSupport' => \OCP\Util::hasExtendedSupport() | |||||
); | ); | ||||
if($this->userSession->isLoggedIn()) { | if($this->userSession->isLoggedIn()) { |
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/** | |||||
* Indicates if the subscription has extended support | |||||
* | |||||
* @since 17.0.0 | |||||
*/ | |||||
public function delegateHasExtendedSupport(): bool { | |||||
if ($this->subscription instanceof ISubscription && method_exists($this->subscription, 'hasExtendedSupport')) { | |||||
return $this->subscription->hasExtendedSupport(); | |||||
} | |||||
return false; | |||||
} | |||||
} | } |
* @since 17.0.0 | * @since 17.0.0 | ||||
*/ | */ | ||||
public function delegateHasValidSubscription(): bool; | public function delegateHasValidSubscription(): bool; | ||||
/** | |||||
* Indicates if the subscription has extended support | |||||
* | |||||
* @since 17.0.0 | |||||
*/ | |||||
public function delegateHasExtendedSupport(): bool; | |||||
} | } |
* @since 17.0.0 | * @since 17.0.0 | ||||
*/ | */ | ||||
public function hasValidSubscription(): bool; | public function hasValidSubscription(): bool; | ||||
/** | |||||
* Indicates if the subscription has extended support | |||||
* | |||||
* @since 17.0.0 | |||||
*/ | |||||
public function hasExtendedSupport(): bool; | |||||
} | } |
public static function getVersion() { | public static function getVersion() { | ||||
return \OC_Util::getVersion(); | return \OC_Util::getVersion(); | ||||
} | } | ||||
/** | |||||
* @since 17.0.0 | |||||
*/ | |||||
public static function hasExtendedSupport(): bool { | |||||
try { | |||||
/** @var \OCP\Support\Subscription\IRegistry */ | |||||
$subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class); | |||||
return $subscriptionRegistry->delegateHasExtendedSupport(); | |||||
} catch (AppFramework\QueryException $e) {} | |||||
return \OC::$server->getConfig()->getSystemValueBool('extendedSupport', false); | |||||
} | |||||
/** | /** | ||||
* Set current update channel | * Set current update channel | ||||
* @param string $channel | * @param string $channel | ||||
public static function setChannel($channel) { | public static function setChannel($channel) { | ||||
\OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel); | \OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel); | ||||
} | } | ||||
/** | /** | ||||
* Get current update channel | * Get current update channel | ||||
* @return string | * @return string | ||||
public static function needUpgrade() { | public static function needUpgrade() { | ||||
if (!isset(self::$needUpgradeCache)) { | if (!isset(self::$needUpgradeCache)) { | ||||
self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getSystemConfig()); | self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getSystemConfig()); | ||||
} | |||||
} | |||||
return self::$needUpgradeCache; | return self::$needUpgradeCache; | ||||
} | } | ||||
# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php | # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php | ||||
# for description and defaults | # for description and defaults | ||||
$defaults = new \OCP\Defaults(); | $defaults = new \OCP\Defaults(); | ||||
$values=array( | |||||
$values = [ | |||||
'installed'=>$installed, | 'installed'=>$installed, | ||||
'maintenance' => $maintenance, | 'maintenance' => $maintenance, | ||||
'needsDbUpgrade' => \OCP\Util::needUpgrade(), | 'needsDbUpgrade' => \OCP\Util::needUpgrade(), | ||||
'version'=>implode('.', \OCP\Util::getVersion()), | 'version'=>implode('.', \OCP\Util::getVersion()), | ||||
'versionstring'=>OC_Util::getVersionString(), | 'versionstring'=>OC_Util::getVersionString(), | ||||
'edition'=> '', | 'edition'=> '', | ||||
'productname'=>$defaults->getName()); | |||||
'productname'=>$defaults->getName(), | |||||
'extendedSupport' => \OCP\Util::hasExtendedSupport() | |||||
]; | |||||
if (OC::$CLI) { | if (OC::$CLI) { | ||||
print_r($values); | print_r($values); | ||||
} else { | } else { |