本文整理匯總了PHP中OC_Util::getBuild方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Util::getBuild方法的具體用法?PHP OC_Util::getBuild怎麽用?PHP OC_Util::getBuild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OC_Util
的用法示例。
在下文中一共展示了OC_Util::getBuild方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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;
}
示例4: 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;
}
示例5: 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;
}