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


PHP Version::fromString方法代码示例

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


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

示例1: preInstall

 /**
  * Pre-installation.
  * @return boolean
  */
 function preInstall()
 {
     $this->currentVersion = Version::fromString('');
     $this->locale = $this->getParam('locale');
     $this->installedLocales = $this->getParam('additionalLocales');
     if (!isset($this->installedLocales) || !is_array($this->installedLocales)) {
         $this->installedLocales = array();
     }
     if (!in_array($this->locale, $this->installedLocales) && Locale::isLocaleValid($this->locale)) {
         array_push($this->installedLocales, $this->locale);
     }
     if ($this->getParam('manualInstall')) {
         // Do not perform database installation for manual install
         // Create connection object with the appropriate database driver for adodb-xmlschema
         $conn =& new DBConnection($this->getParam('databaseDriver'), null, null, null, null);
         $this->dbconn =& $conn->getDBConn();
     } else {
         // Connect to database
         $conn =& new DBConnection($this->getParam('databaseDriver'), $this->getParam('databaseHost'), $this->getParam('databaseUsername'), $this->getParam('databasePassword'), $this->getParam('createDatabase') ? null : $this->getParam('databaseName'), true, $this->getParam('connectionCharset') == '' ? false : $this->getParam('connectionCharset'));
         $this->dbconn =& $conn->getDBConn();
         if (!$conn->isConnected()) {
             $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
             return false;
         }
     }
     DBConnection::getInstance($conn);
     return parent::preInstall();
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:32,代码来源:Install.inc.php

示例2: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao =& new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array('application' => $data['application'][0]['value'], 'release' => $data['release'][0]['value'], 'tag' => $data['tag'][0]['value'], 'date' => $data['date'][0]['value'], 'info' => $data['info'][0]['value'], 'package' => $data['package'][0]['value'], 'patch' => array(), 'version' => Version::fromString($data['release'][0]['value']));
     foreach ($data['patch'] as $patch) {
         $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
     }
     return $versionInfo;
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:19,代码来源:VersionCheck.inc.php

示例3: preInstall

 /**
  * Pre-installation.
  * @return boolean
  */
 function preInstall()
 {
     if (!isset($this->currentVersion)) {
         $this->currentVersion = Version::fromString('');
     }
     $this->locale = $this->getParam('locale');
     $this->installedLocales = $this->getParam('additionalLocales');
     if (!isset($this->installedLocales) || !is_array($this->installedLocales)) {
         $this->installedLocales = array();
     }
     if (!in_array($this->locale, $this->installedLocales) && AppLocale::isLocaleValid($this->locale)) {
         array_push($this->installedLocales, $this->locale);
     }
     // Connect to database
     $conn = new DBConnection($this->getParam('databaseDriver'), $this->getParam('databaseHost'), $this->getParam('databaseUsername'), $this->getParam('databasePassword'), $this->getParam('createDatabase') ? null : $this->getParam('databaseName'), false, $this->getParam('connectionCharset') == '' ? false : $this->getParam('connectionCharset'));
     $this->dbconn =& $conn->getDBConn();
     if (!$conn->isConnected()) {
         $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg());
         return false;
     }
     DBConnection::getInstance($conn);
     return parent::preInstall();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:27,代码来源:PKPInstall.inc.php

示例4: parseInstaller

 /**
  * Parse the installation descriptor XML file.
  * @return boolean
  */
 function parseInstaller()
 {
     // Read installation descriptor file
     $this->log(sprintf('load: %s', $this->descriptor));
     $xmlParser = new XMLParser();
     $installPath = $this->isPlugin ? $this->descriptor : INSTALLER_DATA_DIR . DIRECTORY_SEPARATOR . $this->descriptor;
     $installTree = $xmlParser->parse($installPath);
     if (!$installTree) {
         // Error reading installation file
         $xmlParser->destroy();
         $this->setError(INSTALLER_ERROR_GENERAL, 'installer.installFileError');
         return false;
     }
     $versionString = $installTree->getAttribute('version');
     if (isset($versionString)) {
         $this->newVersion =& Version::fromString($versionString);
     } else {
         $this->newVersion = $this->currentVersion;
     }
     // Parse descriptor
     $this->parseInstallNodes($installTree);
     $xmlParser->destroy();
     $result = $this->getErrorType() == 0;
     HookRegistry::call('Installer::parseInstaller', array(&$this, &$result));
     return $result;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:30,代码来源:Installer.inc.php

示例5: testComparedVersionIsEarlier

 /**
  * @dataProvider getEarlier
  */
 public function testComparedVersionIsEarlier($version1, $version2)
 {
     $this->assertTrue(Version::fromString($version1)->isEarlierThan(Version::fromString($version2)));
 }
开发者ID:phpextra,项目名称:version,代码行数:7,代码来源:VersionTest.php

示例6: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array();
     if (isset($data['application'][0]['value'])) {
         $versionInfo['application'] = $data['application'][0]['value'];
     }
     if (isset($data['type'][0]['value'])) {
         $versionInfo['type'] = $data['type'][0]['value'];
     }
     if (isset($data['release'][0]['value'])) {
         $versionInfo['release'] = $data['release'][0]['value'];
     }
     if (isset($data['tag'][0]['value'])) {
         $versionInfo['tag'] = $data['tag'][0]['value'];
     }
     if (isset($data['date'][0]['value'])) {
         $versionInfo['date'] = $data['date'][0]['value'];
     }
     if (isset($data['info'][0]['value'])) {
         $versionInfo['info'] = $data['info'][0]['value'];
     }
     if (isset($data['package'][0]['value'])) {
         $versionInfo['package'] = $data['package'][0]['value'];
     }
     if (isset($data['patch'][0]['value'])) {
         $versionInfo['patch'] = array();
         foreach ($data['patch'] as $patch) {
             $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
         }
     }
     if (isset($data['class'][0]['value'])) {
         $versionInfo['class'] = (string) $data['class'][0]['value'];
     }
     $versionInfo['lazy-load'] = isset($data['lazy-load'][0]['value']) ? (int) $data['lazy-load'][0]['value'] : 0;
     $versionInfo['sitewide'] = isset($data['sitewide'][0]['value']) ? (int) $data['sitewide'][0]['value'] : 0;
     if (isset($data['release'][0]['value']) && isset($data['application'][0]['value'])) {
         $version =& Version::fromString($data['release'][0]['value'], isset($data['type'][0]['value']) ? $data['type'][0]['value'] : null, $data['application'][0]['value'], isset($data['class'][0]['value']) ? $data['class'][0]['value'] : '', $versionInfo['lazy-load'], $versionInfo['sitewide']);
         $versionInfo['version'] =& $version;
     }
     return $versionInfo;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:52,代码来源:VersionCheck.inc.php

示例7: populateStaticPackages

 /**
  * Populate the collection with 'static' packages. A static package is
  * one which was not produced by or that which has no persistent build
  * event information.
  *
  * Static packages are primarily for historic releases which predate
  * the autobuilder.
  *
  * @param array:$packages  Collection to be populated.
  * @return bool  @c true= iff successful.
  */
 private function populateStaticPackages(&$packages)
 {
     /**
      * @todo Read this information from a config file, we should not
      * expect to edit this file in order to change these...
      */
     $pack = PackageFactory::newDistribution(PID_WIN_X86, 'Doomsday', Version::fromString('1.14'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.14.5/deng-inst-1.14.5.exe/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.14.5');
     $pack->setReleaseDate(strtotime('June 19, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_4_X86_PPC, 'Doomsday', Version::fromString('1.14'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.14.5/deng-inst-1.14.5.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.14.5');
     $pack->setReleaseDate(strtotime('June 19, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_6_X86_X86_64, 'Doomsday', Version::fromString('1.14'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.14.5/deng-inst-1.14.5_64bit.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.14.5');
     $pack->setReleaseDate(strtotime('June 19, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86, 'Doomsday', Version::fromString('1.14'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.14.5/deng-inst-1.14.5_i386.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.14.5');
     $pack->setReleaseDate(strtotime('June 19, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86_64, 'Doomsday', Version::fromString('1.14'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.14.5/deng-inst-1.14.5_amd64.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.14.5');
     $pack->setReleaseDate(strtotime('June 19, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_WIN_X86, 'Doomsday', Version::fromString('1.13'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.13.2/deng-inst-1.13.2.exe/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.13.2');
     $pack->setReleaseDate(strtotime('January 14, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_4_X86_PPC, 'Doomsday', Version::fromString('1.13'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.13.2/deng-inst-1.13.2.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.13.2');
     $pack->setReleaseDate(strtotime('January 14, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_6_X86_X86_64, 'Doomsday', Version::fromString('1.13'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.13.2/deng-inst-1.13.2_64bit.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.13.2');
     $pack->setReleaseDate(strtotime('January 14, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86, 'Doomsday', Version::fromString('1.13'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.13.2/deng-inst-1.13.2_i386.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.13.2');
     $pack->setReleaseDate(strtotime('January 14, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86_64, 'Doomsday', Version::fromString('1.13'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.13.2/deng-inst-1.13.2_amd64.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.13.2');
     $pack->setReleaseDate(strtotime('January 14, 2014'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_WIN_X86, 'Doomsday', Version::fromString('1.12'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.12.2/deng-inst-1.12.2.exe/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.12.2');
     $pack->setReleaseDate(strtotime('November 2, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_4_X86_PPC, 'Doomsday', Version::fromString('1.12'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.12.2/deng-inst-1.12.2.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.12.2');
     $pack->setReleaseDate(strtotime('November 2, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_6_X86_X86_64, 'Doomsday', Version::fromString('1.12'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.12.2/deng-inst-1.12.2_64bit.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.12.2');
     $pack->setReleaseDate(strtotime('November 2, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86, 'Doomsday', Version::fromString('1.12'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.12.2/deng-inst-1.12.2_i386.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.12.2');
     $pack->setReleaseDate(strtotime('November 2, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86_64, 'Doomsday', Version::fromString('1.12'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.12.2/deng-inst-1.12.2_amd64.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.12.2');
     $pack->setReleaseDate(strtotime('November 2, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_WIN_X86, 'Doomsday', Version::fromString('1.11'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.11.2/deng-inst-1.11.2.exe/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.11.2');
     $pack->setReleaseDate(strtotime('August 29, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_4_X86_PPC, 'Doomsday', Version::fromString('1.11'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.11.2/deng-inst-1.11.2.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.11.2');
     $pack->setReleaseDate(strtotime('August 29, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_MAC10_6_X86_X86_64, 'Doomsday', Version::fromString('1.11'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.11.2/deng-inst-1.11.2_64bit.dmg/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.11.2');
     $pack->setReleaseDate(strtotime('August 29, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86, 'Doomsday', Version::fromString('1.11'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.11.2/deng-inst-1.11.2_i386.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.11.2');
     $pack->setReleaseDate(strtotime('August 29, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_LINUX_X86_64, 'Doomsday', Version::fromString('1.11'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.11.2/deng-inst-1.11.2_amd64.deb/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.11.2');
     $pack->setReleaseDate(strtotime('August 29, 2013'));
     $packages[] = $pack;
     $pack = PackageFactory::newDistribution(PID_WIN_X86, 'Doomsday', Version::fromString('1.10'), 'http://sourceforge.net/projects/deng/files/Doomsday%20Engine/1.10.4/deng-inst-1.10.4.exe/download', NULL, false);
     $pack->setReleaseNotesUri('http://dengine.net/dew/index.php?title=Doomsday_version_1.10.4');
     $pack->setReleaseDate(strtotime('July 28, 2013'));
//.........这里部分代码省略.........
开发者ID:laszloekovacs,项目名称:Doomsday-Engine,代码行数:101,代码来源:buildrepository.php

示例8: newFromSimpleXMLElement

 /**
  * Parse a new Package object from a SimpleXMLElement.
  *
  * @param $log_pack  (Object) SimpleXMLElement node to be "parsed".
  * @return  (Object) Resultant Package object.
  */
 public static function newFromSimpleXMLElement(&$log_pack, $releaseType = 'unstable')
 {
     if (!$log_pack instanceof SimpleXMLElement) {
         throw new Exception('Received invalid log_pack');
     }
     $platformId = BuildRepositoryPlugin::parsePlatformId(clean_text($log_pack->platform));
     $cleanDirectDownloadUri = safe_url($log_pack->downloadUri);
     if (!empty($log_pack->downloadFallbackUri)) {
         $cleanDirectDownloadFallbackUri = safe_url($log_pack->downloadFallbackUri);
     } else {
         $cleanDirectDownloadFallbackUri = NULL;
     }
     if (!empty($log_pack->name)) {
         $name = clean_text($log_pack->name);
     } else {
         // We must resort to extracting the name from download Uri.
         $filename = basename(substr($cleanDirectDownloadUri, 0, -9));
         $filename = preg_replace(array('/-/', '/_/'), ' ', $filename);
         $words = explode(' ', substr($filename, 0, strrpos($filename, '.')));
         $name = ucwords(implode(' ', $words));
     }
     if (!empty($log_pack->version)) {
         $versionText = clean_text($log_pack->version);
         $version = Version::fromString($versionText);
     } else {
         $version = NULL;
     }
     // Determine package type.
     foreach ($log_pack->attributes() as $attrib => $value) {
         if ($attrib === 'type') {
             $type = $value;
         }
         break;
     }
     if (!isset($type)) {
         $type = 'distribution';
     }
     switch ($type) {
         case 'plugin':
             if ($releaseType === RT_STABLE) {
                 $pack = new PluginBuilderPackage($platformId, $name, $version, $cleanDirectDownloadUri, $cleanDirectDownloadFallbackUri);
             } else {
                 $pack = new PluginUnstableBuilderPackage($platformId, $name, $version, $cleanDirectDownloadUri, $cleanDirectDownloadFallbackUri);
             }
             break;
         default:
             if ($releaseType === RT_STABLE) {
                 $pack = new DistributionBuilderPackage($platformId, $name, $version, $cleanDirectDownloadUri, $cleanDirectDownloadFallbackUri);
             } else {
                 $pack = new DistributionUnstableBuilderPackage($platformId, $name, $version, $cleanDirectDownloadUri, $cleanDirectDownloadFallbackUri);
             }
             break;
     }
     if (!empty($log_pack->compileLogUri)) {
         $pack->setCompileLogUri(safe_url($log_pack->compileLogUri));
     }
     if (!empty($log_pack->compileWarnCount)) {
         $pack->setCompileWarnCount((int) $log_pack->compileWarnCount);
     }
     if (!empty($log_pack->compileErrorCount)) {
         $pack->setCompileErrorCount((int) $log_pack->compileErrorCount);
     }
     return $pack;
 }
开发者ID:laszloekovacs,项目名称:Doomsday-Engine,代码行数:70,代码来源:packagefactory.class.php


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