本文整理汇总了PHP中OC_Util::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Util::getChannel方法的具体用法?PHP OC_Util::getChannel怎么用?PHP OC_Util::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Util
的用法示例。
在下文中一共展示了OC_Util::getChannel方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
/**
* Check if a new version is available
* @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
* @return array | bool
*/
public function check($updaterUrl)
{
// Look up the cache - it is invalidated all 30 minutes
if (\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800 > time()) {
return json_decode(\OC_Appconfig::getValue('core', 'lastupdateResult'), true);
}
\OC_Appconfig::setValue('core', 'lastupdatedat', time());
if (\OC_Appconfig::getValue('core', 'installedat', '') == '') {
\OC_Appconfig::setValue('core', 'installedat', microtime(true));
}
$version = \OC_Util::getVersion();
$version['installed'] = \OC_Appconfig::getValue('core', 'installedat');
$version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel'] = \OC_Util::getChannel();
$version['edition'] = \OC_Util::getEditionString();
$version['build'] = \OC_Util::getBuild();
$versionString = implode('x', $version);
//fetch xml data from updater
$url = $updaterUrl . '?version=' . $versionString;
// set a sensible timeout of 10 sec to stay responsive even if the update server is down.
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
$xml = @file_get_contents($url, 0, $ctx);
if ($xml == false) {
return array();
}
$data = @simplexml_load_string($xml);
$tmp = array();
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
// Cache the result
\OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data));
return $tmp;
}
示例2: check
/**
* Check if a new version is available
*
* @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
* @return array|bool
*/
public function check($updaterUrl = null)
{
// Look up the cache - it is invalidated all 30 minutes
if ((int) $this->config->getAppValue('core', 'lastupdatedat') + 1800 > time()) {
return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
}
if (is_null($updaterUrl)) {
$updaterUrl = 'https://updates.owncloud.com/server/';
}
$this->config->setAppValue('core', 'lastupdatedat', time());
if ($this->config->getAppValue('core', 'installedat', '') === '') {
$this->config->setAppValue('core', 'installedat', microtime(true));
}
$version = Util::getVersion();
$version['installed'] = $this->config->getAppValue('core', 'installedat');
$version['updated'] = $this->config->getAppValue('core', 'lastupdatedat');
$version['updatechannel'] = \OC_Util::getChannel();
$version['edition'] = \OC_Util::getEditionString();
$version['build'] = \OC_Util::getBuild();
$versionString = implode('x', $version);
//fetch xml data from updater
$url = $updaterUrl . '?version=' . $versionString;
$tmp = [];
$xml = $this->getUrlContent($url);
if ($xml) {
$loadEntities = libxml_disable_entity_loader(true);
$data = @simplexml_load_string($xml);
libxml_disable_entity_loader($loadEntities);
if ($data !== false) {
$tmp['version'] = (string) $data->version;
$tmp['versionstring'] = (string) $data->versionstring;
$tmp['url'] = (string) $data->url;
$tmp['web'] = (string) $data->web;
} else {
libxml_clear_errors();
}
} else {
$data = [];
}
// Cache the result
$this->config->setAppValue('core', 'lastupdateResult', json_encode($data));
return $tmp;
}
示例3: getChannel
/**
* Get current update channel
* @return string
* @since 8.1.0
*/
public static function getChannel()
{
return \OC_Util::getChannel();
}
示例4: getHumanVersion
/**
* A human readable string is generated based on version, channel and build number
*
* @return string
*/
public static function getHumanVersion()
{
$version = OC_Util::getVersionString() . ' (' . OC_Util::getChannel() . ')';
$build = OC_Util::getBuild();
if (!empty($build) and OC_Util::getChannel() === 'daily') {
$version .= ' Build:' . $build;
}
return $version;
}
示例5: doUpgrade
/**
* runs the update actions in maintenance mode, does not upgrade the source files
* except the main .htaccess file
*
* @param string $currentVersion current version to upgrade to
* @param string $installedVersion previous version from which to upgrade from
*
* @throws \Exception
* @return bool true if the operation succeeded, false otherwise
*/
private function doUpgrade($currentVersion, $installedVersion)
{
// Stop update if the update is over several major versions
$allowedPreviousVersion = $this->getAllowedPreviousVersion();
if (!self::isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersion)) {
throw new \Exception('Updates between multiple major versions and downgrades are unsupported.');
}
// Update .htaccess files
try {
Setup::updateHtaccess();
Setup::protectDataDirectory();
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
// create empty file in data dir, so we can later find
// out that this is indeed an ownCloud data directory
// (in case it didn't exist before)
file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
// pre-upgrade repairs
$repair = new Repair(Repair::getBeforeUpgradeRepairSteps());
$this->emitRepairMessages($repair);
$repair->run();
// simulate DB upgrade
if ($this->simulateStepEnabled) {
$this->checkCoreUpgrade();
// simulate apps DB upgrade
$this->checkAppUpgrade($currentVersion);
}
if ($this->updateStepEnabled) {
$this->doCoreUpgrade();
// install new shipped apps on upgrade
OC_Installer::installShippedApps();
// update all shipped apps
$disabledApps = $this->checkAppsRequirements();
$this->doAppUpgrade();
// upgrade appstore apps
$this->upgradeAppStoreApps($disabledApps);
// post-upgrade repairs
$repair = new Repair(Repair::getRepairSteps());
$this->emitRepairMessages($repair);
$repair->run();
//Invalidate update feed
$this->config->setAppValue('core', 'lastupdatedat', 0);
// Check for code integrity on the stable channel
if (\OC_Util::getChannel() === 'stable') {
$this->emit('\\OC\\Updater', 'startCheckCodeIntegrity');
$this->checker->runInstanceVerification();
$this->emit('\\OC\\Updater', 'finishedCheckCodeIntegrity');
}
// only set the final version if everything went well
$this->config->setSystemValue('version', implode('.', \OCP\Util::getVersion()));
}
}
示例6: buildUpdateUrl
/**
* @param string $baseUrl
* @return string
*/
private function buildUpdateUrl($baseUrl)
{
return $baseUrl . '?version=' . implode('x', \OCP\Util::getVersion()) . 'xinstalledatxlastupdatedatx' . \OC_Util::getChannel() . 'x' . \OC_Util::getEditionString() . 'x';
}
示例7: getHumanVersion
/**
* A human readable string is generated based on version, channel and build number
* @return string
*/
public static function getHumanVersion()
{
$version = '7.0.4+dfsg-4~deb8u1 (Debian)' . ' (' . OC_Util::getChannel() . ')';
$build = OC_Util::getBuild();
if (!empty($build) and OC_Util::getChannel() === 'daily') {
$version .= ' Build:' . $build;
}
return $version;
}
示例8: testGetChannel
public function testGetChannel()
{
$this->assertSame(\OC_Util::getChannel(), $this->environmentHelper->getChannel());
}
示例9: getChannel
/**
* @return string
*/
protected function getChannel()
{
return \OC_Util::getChannel();
}
示例10: check
/**
* Check if a new version is available
*
* @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
* @return array|bool
*/
public function check($updaterUrl = null) {
// Look up the cache - it is invalidated all 30 minutes
if (($this->config->getValue('core', 'lastupdatedat') + 1800) > time()) {
return json_decode($this->config->getValue('core', 'lastupdateResult'), true);
}
if (is_null($updaterUrl)) {
$updaterUrl = 'https://apps.owncloud.com/updater.php';
}
$this->config->setValue('core', 'lastupdatedat', time());
if ($this->config->getValue('core', 'installedat', '') == '') {
$this->config->setValue('core', 'installedat', microtime(true));
}
$version = \OC_Util::getVersion();
$version['installed'] = $this->config->getValue('core', 'installedat');
$version['updated'] = $this->config->getValue('core', 'lastupdatedat');
$version['updatechannel'] = \OC_Util::getChannel();
$version['edition'] = \OC_Util::getEditionString();
$version['build'] = \OC_Util::getBuild();
$versionString = implode('x', $version);
//fetch xml data from updater
$url = $updaterUrl . '?version=' . $versionString;
// set a sensible timeout of 10 sec to stay responsive even if the update server is down.
$tmp = array();
$xml = $this->httpHelper->getUrlContent($url);
if ($xml) {
$loadEntities = libxml_disable_entity_loader(true);
$data = @simplexml_load_string($xml);
libxml_disable_entity_loader($loadEntities);
if ($data !== false) {
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
}
} else {
$data = array();
}
// Cache the result
$this->config->setValue('core', 'lastupdateResult', json_encode($data));
return $tmp;
}