Ejemplo n.º 1
0
 static function major_version()
 {
     return major_version();
 }
Ejemplo n.º 2
0
/** check for changes between versions */
function last_version($array)
{
    $majors = array();
    $last = null;
    $last_tag = null;
    $last_php = true;
    $output = '';
    foreach ($array as $tag => $val) {
        if (!$val) {
            continue;
        }
        if (!$last) {
            $last = $val;
        }
        if (!$last_tag) {
            $last_tag = $tag;
        }
        $majorver = major_version($tag);
        $first_major_release = false;
        $now_php = is_php($tag);
        if (!$now_php && $last_php) {
            // now we have PECl stuff. reset the major versions array
            $majors = array();
        }
        if (!isset($majors[$majorver])) {
            $majors[$majorver] = $val;
            $first_major_release = true;
        } elseif ($majors[$majorver] !== $val) {
            // the value isnt the same in this major version
            $majors[$majorver] = false;
        }
        // the change is only significant if not comparing between PHP and PECL releases
        if ($val !== $last && ($now_php || !$last_php)) {
            $pkg = is_php($tag) ? 'PHP' : pkg_name($tag);
            if ($output) {
                $output .= ' ';
            }
            if ($first_major_release) {
                if (empty($majors[$majorver - 1]) || count($majors) > 2) {
                    $ver = "< {$majorver}";
                } else {
                    $ver = $majorver - 1;
                }
            } else {
                $ver = '<= ' . tag2version($last_tag);
            }
            $output .= "{$last} in {$pkg} " . $ver . '.';
        }
        $last = $val;
        $last_tag = $tag;
        $last_php = $now_php;
    }
    return $output;
}