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


PHP OA::stripVersion方法代码示例

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


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

示例1: getConfigVersion

 /**
  * Returns phpAdsNew style config version.
  *
  * The OpenX version "number" is converted to an int using the following table:
  *
  * 'beta-rc' => 0.1
  * 'beta'    => 0.2
  * 'rc'      => 0.3
  * ''        => 0.4
  *
  * i.e.
  * v0.3.29-beta-rc10 becomes:
  *  0   *   1000 +
  *  3   *    100 +
  * 29   *      1 +    // Cannot exceed 100 patch releases!
  *  0.1          +
  * 10   /   1000 =
  * -------------
  *        3293.1
  */
 function getConfigVersion($version)
 {
     $a = array('dev' => -0.001, 'beta-rc' => 0.1, 'beta' => 0.2, 'rc' => 0.3, 'stable' => 0.4);
     $version = OA::stripVersion($version, array('dev', 'stable'));
     if (preg_match('/^v/', $version)) {
         $v = preg_split('/[.-]/', substr($version, 1));
     } else {
         $v = preg_split('/[.-]/', $version);
     }
     if (count($v) < 3) {
         return false;
     }
     // Prepare value from the first 3 items
     $returnValue = $v[0] * 1000 + $v[1] * 100 + $v[2];
     // How many items were there?
     if (count($v) == 5) {
         // Check that it is a beta-rc release
         if (!$v[3] == 'beta' || !preg_match('/^rc(\\d+)/', $v[4], $aMatches)) {
             return false;
         }
         // Add the beta-rc
         $returnValue += $a['beta-rc'] + $aMatches[1] / 1000;
         return $returnValue;
     } else {
         if (count($v) == 4) {
             // Check that it is a tag or rc numer
             if (isset($a[$v[3]])) {
                 // Add the beta
                 $returnValue += $a[$v[3]];
                 return $returnValue;
             } else {
                 if (preg_match('/^rc(\\d+)/', $v[3], $aMatches)) {
                     // Add the rc
                     $returnValue += $a['rc'] + $aMatches[1] / 1000;
                     return $returnValue;
                 }
             }
             return false;
         }
     }
     // Stable release
     $returnValue += $a['stable'];
     return $returnValue;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:64,代码来源:Sync.php

示例2: getUpgradePackageList

 /**
  * walk an array of version information to build a list of required upgrades
  * they must be in the RIGHT order!!!
  * hence the weird sorting of keys etc..
  */
 function getUpgradePackageList($verPrev, $aVersions = null)
 {
     $verPrev = OA::stripVersion($verPrev);
     $aFiles = array();
     if (is_array($aVersions)) {
         ksort($aVersions, SORT_NUMERIC);
         foreach ($aVersions as $release => $aMajor) {
             ksort($aMajor, SORT_NUMERIC);
             foreach ($aMajor as $major => $aMinor) {
                 ksort($aMinor, SORT_NUMERIC);
                 foreach ($aMinor as $minor => $aStatus) {
                     if (array_key_exists('-beta-rc', $aStatus)) {
                         $aKeys = array_keys($aStatus['-beta-rc']);
                         sort($aKeys, SORT_NUMERIC);
                         foreach ($aKeys as $k => $v) {
                             $version = $release . '.' . $major . '.' . $minor . '-beta-rc' . $v;
                             if (version_compare($verPrev, $version) < 0) {
                                 $aFiles[] = $aStatus['-beta-rc'][$v]['file'];
                             }
                         }
                     }
                     if (array_key_exists('-beta', $aStatus)) {
                         $aBeta = $aStatus['-beta'];
                         foreach ($aBeta as $key => $file) {
                             $version = $release . '.' . $major . '.' . $minor . '-beta';
                             if (version_compare($verPrev, $version) < 0) {
                                 $aFiles[] = $file;
                             }
                         }
                     }
                     if (array_key_exists('-dev', $aStatus)) {
                         $aDev = $aStatus['-dev'];
                         foreach ($aDev as $key => $file) {
                             $version = $release . '.' . $major . '.' . $minor . '-dev';
                             if (version_compare($verPrev, $version) < 0) {
                                 $aFiles[] = $file;
                             }
                         }
                     }
                     if (array_key_exists('-rc', $aStatus)) {
                         $aKeys = array_keys($aStatus['-rc']);
                         sort($aKeys, SORT_NUMERIC);
                         foreach ($aKeys as $k => $v) {
                             $version = $release . '.' . $major . '.' . $minor . '-rc' . $v;
                             if (version_compare($verPrev, $version) < 0) {
                                 $aFiles[] = $aStatus['-rc'][$v]['file'];
                             }
                         }
                     }
                     if (array_key_exists('-RC', $aStatus)) {
                         $aKeys = array_keys($aStatus['-RC']);
                         sort($aKeys, SORT_NUMERIC);
                         foreach ($aKeys as $k => $v) {
                             $version = $release . '.' . $major . '.' . $minor . '-RC' . $v;
                             if (version_compare($verPrev, $version) < 0) {
                                 $aFiles[] = $aStatus['-RC'][$v]['file'];
                             }
                         }
                     }
                     if (array_key_exists('file', $aStatus)) {
                         $version = $release . '.' . $major . '.' . $minor;
                         if (version_compare($verPrev, $version) < 0) {
                             $aFiles[] = $aStatus['file'];
                         }
                     }
                 }
             }
         }
     }
     return $aFiles;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:76,代码来源:Upgrade.php


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