当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::getVersion方法代码示例

本文整理汇总了PHP中OCP\Util::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getVersion方法的具体用法?PHP Util::getVersion怎么用?PHP Util::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Util的用法示例。


在下文中一共展示了Util::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     $this->l = \OC::$server->getL10N('lib');
     $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 */
     $this->defaultTitle = 'ownCloud';
     /* can be a longer name, for titles */
     $this->defaultBaseUrl = 'https://owncloud.org';
     $this->defaultSyncClientUrl = 'https://owncloud.org/sync-clients/';
     $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8';
     $this->defaultiTunesAppId = '543672169';
     $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.owncloud.android';
     $this->defaultDocBaseUrl = 'https://doc.owncloud.org';
     $this->defaultDocVersion = $version[0] . '.' . $version[1];
     // used to generate doc links
     $this->defaultSlogan = $this->l->t('web services under your control');
     $this->defaultLogoClaim = '';
     $this->defaultMailHeaderColor = '#1d2d44';
     /* header color of mail notifications */
     $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
     if (file_exists($themePath)) {
         // prevent defaults.php from printing output
         ob_start();
         require_once $themePath;
         ob_end_clean();
         if (class_exists('OC_Theme')) {
             $this->theme = new OC_Theme();
         }
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:33,代码来源:defaults.php

示例2: providesLoggerMethods

 public function providesLoggerMethods()
 {
     $methods = [['alert'], ['warning'], ['emergency'], ['critical'], ['error'], ['notice'], ['info'], ['debug']];
     if (version_compare(implode('.', \OCP\Util::getVersion()), '8.2', '>=')) {
         $methods[] = ['logException', new \Exception()];
     }
     return $methods;
 }
开发者ID:matiasdelellis,项目名称:mail,代码行数:8,代码来源:loggertest.php

示例3: getCapabilities

 public static function getCapabilities()
 {
     $result = array();
     list($major, $minor, $micro) = \OCP\Util::getVersion();
     $result['version'] = array('major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => \OC_Util::getVersionString(), 'edition' => \OC_Util::getEditionString());
     $result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities();
     return new Result($result);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:8,代码来源:Cloud.php

示例4: testGetVersion

 public function testGetVersion()
 {
     $version = \OCP\Util::getVersion();
     $this->assertTrue(is_array($version));
     foreach ($version as $num) {
         $this->assertTrue(is_int($num));
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:8,代码来源:UtilTest.php

示例5: setUp

 protected function setUp()
 {
     $this->ownCloudVersion = \OCP\Util::getVersion();
     $this->cleanUp();
     $app = new Application();
     $this->container = $app->getContainer();
     $this->itemMapper = $this->container->query('OCA\\News\\Db\\ItemMapper');
     $this->feedMapper = $this->container->query('OCA\\News\\Db\\FeedMapper');
     $this->folderMapper = $this->container->query('OCA\\News\\Db\\FolderMapper');
     $this->loadFixtures($this->folderMapper, $this->feedMapper, $this->itemMapper);
 }
开发者ID:sbambach,项目名称:news,代码行数:11,代码来源:bootstrap.php

示例6: checkVersion

 public static function checkVersion($newVersionArray, $newVersionString)
 {
     $l10n = \OC::$server->getL10N('updater');
     $currentVersionArray = \OCP\Util::getVersion();
     $currentVersion = \OC_Util::getVersionString();
     $difference = intval($newVersionArray[0]) - intval($currentVersionArray[0]);
     if ($difference > 1 || $difference < 0 || version_compare($currentVersion, $newVersionString) > 0) {
         $message = (string) $l10n->t('Not possible to update %s to %s. Downgrading or skipping major releases is not supported.', [$currentVersion, implode('.', $newVersionArray)]);
         \OC::$server->getLogger()->error($message, ['app' => 'updater']);
         throw new \Exception($message);
     }
 }
开发者ID:amin-hedayati,项目名称:updater,代码行数:12,代码来源:helper.php

示例7: index

 /**
  * CAUTION: the @Stuff turn off security checks, for this page no admin is
  *          required and no CSRF check. If you don't know what CSRF is, read
  *          it up in the docs or you might create a security hole. This is
  *          basically the only required method to add this exemption, don't
  *          add it to any other method if you don't exactly know what it does
  *
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $params = array('user' => $this->userId);
     $response = new TemplateResponse('ownmnote', 'main', $params);
     $ocVersion = \OCP\Util::getVersion();
     if ($ocVersion[0] > 8 || $ocVersion[0] == 8 && $ocVersion[1] >= 1) {
         $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
         $csp->addAllowedImageDomain('data:');
         $response->setContentSecurityPolicy($csp);
     }
     return $response;
 }
开发者ID:Viperoo,项目名称:ownmnote,代码行数:22,代码来源:pagecontroller.php

示例8: checkVersion

 public static function checkVersion($newVersionArray, $newVersionString)
 {
     $l10n = \OC::$server->getL10N('updater');
     $currentVersionArray = \OCP\Util::getVersion();
     $currentVersion = \OC_Util::getVersionString();
     // https://github.com/owncloud/core/issues/18880
     // Always positive for versions >= 100.0.0.0
     if (version_compare($newVersionString, '100.0.0.0', '>=')) {
         return;
     }
     $difference = intval($newVersionArray[0]) - intval($currentVersionArray[0]);
     if ($difference > 1 || $difference < 0 || version_compare($currentVersion, $newVersionString) > 0) {
         $message = (string) $l10n->t('Not possible to update %s to %s. Downgrading or skipping major releases is not supported.', [$currentVersion, implode('.', $newVersionArray)]);
         \OC::$server->getLogger()->error($message, ['app' => 'updater']);
         throw new \Exception($message);
     }
 }
开发者ID:FelixHsieh,项目名称:updater,代码行数:17,代码来源:helper.php

示例9: 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;
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:49,代码来源:VersionCheck.php

示例10: array

 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
try {
    require_once 'lib/base.php';
    $systemConfig = \OC::$server->getSystemConfig();
    $installed = $systemConfig->getValue('installed') == 1;
    $maintenance = $systemConfig->getValue('maintenance', false);
    $values = array('installed' => $installed, 'maintenance' => $maintenance, 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => OC_Util::getVersionString(), 'edition' => OC_Util::getEditionString());
    if (OC::$CLI) {
        print_r($values);
    } else {
        header('Access-Control-Allow-Origin: *');
        header('Content-Type: application/json');
        echo json_encode($values);
    }
} catch (Exception $ex) {
    OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
    \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
}
开发者ID:kenwi,项目名称:core,代码行数:31,代码来源:status.php

示例11: printUpgradePage

 /**
  * Prints the upgrade page
  */
 private static function printUpgradePage()
 {
     $systemConfig = \OC::$server->getSystemConfig();
     $oldTheme = $systemConfig->getValue('theme');
     $systemConfig->setValue('theme', '');
     \OCP\Util::addScript('config');
     // needed for web root
     \OCP\Util::addScript('update');
     // check whether this is a core update or apps update
     $installedVersion = $systemConfig->getValue('version', '0.0.0');
     $currentVersion = implode('.', \OCP\Util::getVersion());
     $appManager = \OC::$server->getAppManager();
     $tmpl = new OC_Template('', 'update.admin', 'guest');
     $tmpl->assign('version', OC_Util::getVersionString());
     // if not a core upgrade, then it's apps upgrade
     if (version_compare($currentVersion, $installedVersion, '=')) {
         $tmpl->assign('isAppsOnlyUpgrade', true);
     } else {
         $tmpl->assign('isAppsOnlyUpgrade', false);
     }
     // get third party apps
     $ocVersion = \OCP\Util::getVersion();
     $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
     $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion));
     $tmpl->assign('productName', 'ownCloud');
     // for now
     $tmpl->assign('oldTheme', $oldTheme);
     $tmpl->printPage();
 }
开发者ID:gmurayama,项目名称:core,代码行数:32,代码来源:base.php

示例12: installApp

 /**
  * @param string $app
  * @return bool
  * @throws Exception if app is not compatible with this version of ownCloud
  * @throws Exception if no app-name was specified
  */
 public static function installApp($app)
 {
     $l = \OC::$server->getL10N('core');
     $config = \OC::$server->getConfig();
     $ocsClient = new OCSClient(\OC::$server->getHTTPClientService(), $config, \OC::$server->getLogger());
     $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)) {
         $shippedVersion = self::getAppVersion($app);
         if ($appData && version_compare($shippedVersion, $appData['version'], '<')) {
             $app = self::downloadApp($app);
         } else {
             $app = OC_Installer::installShippedApp($app);
         }
     } else {
         // Maybe the app is already installed - compare the version in this
         // case and use the local already installed one.
         // FIXME: This is a horrible hack. I feel sad. The god of code cleanness may forgive me.
         $internalAppId = self::getInternalAppIdByOcs($app);
         if ($internalAppId !== false) {
             if ($appData && version_compare(\OC_App::getAppVersion($internalAppId), $appData['version'], '<')) {
                 $app = self::downloadApp($app);
             } else {
                 self::enable($internalAppId);
                 $app = $internalAppId;
             }
         } else {
             $app = self::downloadApp($app);
         }
     }
     if ($app !== false) {
         // check if the app is compatible with this version of ownCloud
         $info = self::getAppInfo($app);
         $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.', array($info['name'])));
         }
         // check for required dependencies
         $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
         $missing = $dependencyAnalyzer->analyze($info);
         if (!empty($missing)) {
             $missingMsg = join(PHP_EOL, $missing);
             throw new \Exception($l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', array($info['name'], $missingMsg)));
         }
         $config->setAppValue($app, 'enabled', 'yes');
         if (isset($appData['id'])) {
             $config->setAppValue($app, 'ocsid', $appData['id']);
         }
         \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
     } else {
         throw new \Exception($l->t("No app name specified"));
     }
     return $app;
 }
开发者ID:pierreozoux,项目名称:core,代码行数:60,代码来源:app.php

示例13: loadContacts

 /**
  * Partially importe this function from owncloud Chat app
  * https://github.com/owncloud/chat/blob/master/app/chat.php
  */
 private function loadContacts()
 {
     $this->contacts = array();
     $this->contactsInverted = array();
     // Cache country because of loops
     $configuredCountry = $this->cfgMapper->getCountry();
     $cm = $this->contactsManager;
     if ($cm == null) {
         return;
     }
     $result = $cm->search('', array('FN'));
     foreach ($result as $r) {
         if (isset($r["TEL"])) {
             $phoneIds = $r["TEL"];
             if (is_array($phoneIds)) {
                 $countPhone = count($phoneIds);
                 for ($i = 0; $i < $countPhone; $i++) {
                     $phoneNumber = preg_replace("#[ ]#", "", $phoneIds[$i]);
                     $this->pushPhoneNumberToCache($phoneNumber, $r["FN"], $configuredCountry);
                 }
             } else {
                 $phoneNumber = preg_replace("#[ ]#", "", $phoneIds);
                 $this->pushPhoneNumberToCache($phoneNumber, $r["FN"], $configuredCountry);
             }
             if (isset($r["PHOTO"])) {
                 // Remove useless prefix
                 $ocversion = \OCP\Util::getVersion();
                 $photoURL = preg_replace("#^VALUE=uri:#", "", $r["PHOTO"], 1);
                 $this->contactPhotos[$r["FN"]] = $photoURL;
             }
         }
     }
 }
开发者ID:nerzhul,项目名称:ocsms,代码行数:37,代码来源:contactcache.php

示例14: needUpgrade

 /**
  * Check whether the instance needs to perform an upgrade,
  * either when the core version is higher or any app requires
  * an upgrade.
  *
  * @param \OCP\IConfig $config
  * @return bool whether the core or any app needs an upgrade
  */
 public static function needUpgrade(\OCP\IConfig $config)
 {
     if ($config->getSystemValue('installed', false)) {
         $installedVersion = $config->getSystemValue('version', '0.0.0');
         $currentVersion = implode('.', \OCP\Util::getVersion());
         $versionDiff = version_compare($currentVersion, $installedVersion);
         if ($versionDiff > 0) {
             return true;
         } else {
             if ($versionDiff < 0) {
                 // downgrade attempt, throw exception
                 throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
             }
         }
         // also check for upgrades for apps (independently from the user)
         $apps = \OC_App::getEnabledApps(false, true);
         $shouldUpgrade = false;
         foreach ($apps as $app) {
             if (\OC_App::shouldUpgrade($app)) {
                 $shouldUpgrade = true;
                 break;
             }
         }
         return $shouldUpgrade;
     } else {
         return false;
     }
 }
开发者ID:Angelos0,项目名称:core,代码行数:36,代码来源:util.php

示例15: testDataDirNotWritableSetup

 /**
  * Tests no error is given when the datadir is not writable during setup
  */
 public function testDataDirNotWritableSetup()
 {
     chmod($this->datadir, 0300);
     $result = \OC_Util::checkServer($this->getConfig(array('installed' => false, 'version' => implode('.', \OCP\Util::getVersion()))));
     chmod($this->datadir, 0700);
     //needed for cleanup
     $this->assertEmpty($result);
 }
开发者ID:kenwi,项目名称:core,代码行数:11,代码来源:utilcheckserver.php


注:本文中的OCP\Util::getVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。