Beispiel #1
0
/**
 * Check if DB schema is valid
 * 
 * @param pointer $db Database class
 * @return string message
 * @todo Update list of versions
 */
function checkSchemaVersion(&$db)
{
    $result = array('status' => tl::ERROR, 'msg' => null, 'kill_session' => true);
    $last_version = TL_LAST_DB_VERSION;
    $db_version_table = DB_TABLE_PREFIX . 'db_version';
    $sql = "SELECT * FROM {$db_version_table} ORDER BY upgrade_ts DESC";
    $res = $db->exec_query($sql, 1);
    if (!$res) {
        return $result['msg'] = "Failed to get Schema version from DB";
    }
    $myrow = $db->fetch_array($res);
    $upgrade_msg = "You need to upgrade your Testlink Database to {$last_version} - <br>" . '<a href="./install/index.php" style="color: white">click here access install and upgrade page </a><br>';
    $manualop_msg = "You need to proceed with Manual upgrade of your DB scheme to {$last_version} - Read README file!";
    switch (trim($myrow['version'])) {
        case '1.7.0 Alpha':
        case '1.7.0 Beta 1':
        case '1.7.0 Beta 2':
        case '1.7.0 Beta 3':
        case '1.7.0 Beta 4':
        case '1.7.0 Beta 5':
        case '1.7.0 RC 2':
        case '1.7.0 RC 3':
        case 'DB 1.1':
        case 'DB 1.2':
            $result['msg'] = $upgrade_msg;
            break;
        case 'DB 1.3':
        case 'DB 1.4':
        case 'DB 1.5':
        case 'DB 1.6':
        case 'DB 1.9.8':
            $result['msg'] = $manualop_msg;
            break;
        case $last_version:
            $result['status'] = tl::OK;
            $result['kill_session'] = 'false';
            break;
        default:
            $result['msg'] = "Unknown Schema version " . trim($myrow['version']) . ", please upgrade your Testlink Database to " . $last_version;
            break;
    }
    return $result;
}
Beispiel #2
0
/**
 * Check if DB schema is valid
 * 
 * @param pointer $db Database class
 * @return string message
 * @todo Update list of versions
 */
function checkSchemaVersion(&$db)
{
    $last_version = 'DB 1.3';
    // havlatm: updated for 1.9
    $db_version_table = DB_TABLE_PREFIX . 'db_version';
    $sql = "SELECT * FROM {$db_version_table} ORDER BY upgrade_ts DESC";
    $res = $db->exec_query($sql, 1);
    if (!$res) {
        return $msg = "Failed to get Schema version from DB";
    }
    $myrow = $db->fetch_array($res);
    $msg = "";
    switch (trim($myrow['version'])) {
        case '1.7.0 Alpha':
        case '1.7.0 Beta 1':
        case '1.7.0 Beta 2':
        case '1.7.0 Beta 3':
        case '1.7.0 Beta 4':
        case '1.7.0 Beta 5':
        case '1.7.0 RC 2':
        case '1.7.0 RC 3':
        case 'DB 1.1':
        case 'DB 1.2':
            $msg = "You need to upgrade your Testlink Database to {$last_version} - <br>" . '<a href="SCHEMA_CHANGES" style="color: white"> click here to see the Schema changes </a><br>' . '<a href="./install/index.php" style="color: white">click here access install and upgrade page </a><br>';
            break;
        case $last_version:
            break;
        default:
            $msg = "Unknown Schema version " . trim($myrow['version']) . ", please upgrade your Testlink Database to " . $last_version;
            break;
    }
    return $msg;
}