예제 #1
0
function dbUtil()
{
    reset_db_result();
    $args_arr = func_get_args();
    $type = $args_arr[0];
    try {
        $mongo = new MongoClient('mongodb://nb403:27127/admin:admin');
        $db = $mongo->svnCodeComment;
        if ($type == GetProductList) {
            return getProductList($db);
        } elseif ($type == GetVersionList) {
            $prodName = $args_arr[1];
            return getVersionList($db, $prodName);
        } elseif ($type == CodeSearch) {
            list($prodName, $version, $keyword) = array_slice($args_arr, 1);
            return codeSearch($db, $prodName, $version, $keyword);
        } elseif ($type == CodeSearchDetail) {
            list($prodName, $id) = array_slice($args_arr, 1);
            return codeSearchDetail($db, $prodName, $id);
        } elseif ($type == AddCodeInfo) {
            list($codeSvnPathWithVersion, $version, $prodName, $creator, $diskPath) = array_slice($args_arr, 1);
            return addCodeInfo($db, $codeSvnPathWithVersion, $version, $prodName, $creator, $diskPath);
        } elseif ($type == GetCommentorList) {
            $prodName = $args_arr[1];
            return getCommentorList($db, $prodName);
        } elseif ($type == GetCreator) {
            list($prodName, $version) = array_slice($args_arr, 1);
            return getCreator($db, $prodName, $version);
        } elseif ($type == GetCodeDiskPath) {
            list($prodName, $version) = array_slice($args_arr, 1);
            return getCodeDiskPath($db, $prodName, $version);
        } elseif ($type == GetCodeInfo) {
            list($prodName, $version) = array_slice($args_arr, 1);
            return getCodeInfo($db, $prodName, $version);
        } elseif ($type == GetProdNameMap) {
            return getProdNameMap($db);
        } elseif ($type == SetProdNameMap) {
            list($prodName, $tableName) = array_slice($args_arr, 1);
            return setProdNameMap($db, $prodName, $tableName);
        }
    } catch (MongoConnectionException $e) {
        set_db_result("1", $e->getMessage());
    }
}
예제 #2
0
function findNextVersion($lastversion = null)
{
    global $gbl, $sgbl, $login, $ghtml;
    $maj = $sgbl->__ver_major;
    $thisversion = $sgbl->__ver_major_minor_release;
    $upgrade = null;
    $nlist = getVersionList($lastversion);
    dprintr($nlist);
    $k = 0;
    foreach ($nlist as $l) {
        if (version_cmp($thisversion, $l) === -1) {
            $upgrade = $l;
            break;
        }
        $k++;
    }
    if (!$upgrade) {
        return 0;
    }
    print "Updating from {$thisversion} to {$upgrade}\n";
    return $upgrade;
}
예제 #3
0
<?php

include_once "htmllib/lib/include.php";
include_once "htmllib/lib/updatelib.php";
print "Getting Version list\n";
$v = getVersionList();
print_r($v);
if ($v[0] === $sgbl->__ver_major_minor_release) {
    print "Hey Same version\n";
    exit(8);
}
exit(0);
예제 #4
0
파일: lib.php 프로젝트: lonelywoolf/hypervm
function getLatestVersion()
{
    $nlist = getVersionList();
    return $nlist[count($nlist) - 1];
}
예제 #5
0
파일: lib.php 프로젝트: soar-team/kloxo
/**
 * Get a version list and see if a update is avaible
 * Issue #781 - Update to the latest version instead one by one
 * Added _ () for the future :)
 *
 * @param      string $LastVersion Not Used?
 * @return     string    Returns zero or version number
 * @author     Danny Terweij d.terweij@lxcenter.org
 */
function findNextVersion($lastVersion = null)
{
    global $sgbl;
    $thisVersion = $sgbl->__ver_major_minor_release;
    $Upgrade = null;
    $versionList = getVersionList($lastVersion);
    print _('Found version(s):');
    foreach ($versionList as $newVersion) {
        print ' ' . $newVersion;
    }
    print PHP_EOL;
    if (version_cmp($thisVersion, $newVersion) === -1) {
        $Upgrade = $newVersion;
    }
    if (version_cmp($thisVersion, $newVersion) === 1) {
        unset($Upgrade);
        print _('Your version ') . $thisVersion . _(' is higher then ') . $newVersion . PHP_EOL;
        print _('Script aborted') . PHP_EOL;
        exit;
    }
    if (!$Upgrade) {
        return 0;
    }
    print _('Upgrading from ') . $thisVersion . _(' to ') . $Upgrade . PHP_EOL;
    return $Upgrade;
}