Пример #1
0
$DBversion = '0.30.00.03';
if (GetVersion() < TransformToNum($DBversion)) {
    mysql_query("ALTER TABLE `clients` ADD `category` VARCHAR( 100 ) NULL AFTER `machine_name`");
    SetVersion($DBversion);
    echo "Updated Clients Table\n";
}
$DBversion = '0.30.00.04';
if (GetVersion() < TransformToNum($DBversion)) {
    mysql_query("ALTER TABLE `logins` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT");
    SetVersion($DBversion);
    echo "Updated Logins Table ( Set id to auto increment )\n";
}
$DBversion = '0.30.00.05';
if (GetVersion() < TransformToNum($DBversion)) {
    mysql_query(" ALTER TABLE `clients` ADD `command` VARCHAR( 10 ) NULL");
    SetVersion($DBversion);
    echo "Updated Logins Table ( Set id to auto increment )\n";
}
echo "Finished updating Libki Database\n";
$version = GetVersion();
echo "Libki Database is now at version {$version}\n";
function TransformToNum($version)
{
    # remove the 3 last . to have a Perl number
    $parts = explode('.', $version);
    $primary = $parts[0];
    $secondary = implode(null, array($parts[1], $parts[2], $parts[3]));
    $version = "{$primary}.{$secondary}";
    return $version;
}
function SetVersion($libki_version)
Пример #2
0
}
// Get Variables
$product = $_GET["product"];
$major = $_GET["major"];
$minor = $_GET["minor"];
$debug = $_GET["debug"];
$build = $_GET["build_id"];
$user = $_GET["username"];
$machine = $_GET["machine_name"];
$changeset = $_GET["changeset_id"];
$checked_out = $_GET["checked_out"];
$template = $_GET["template"];
// Check the variables
if ($product == "" || $major == "" || $minor == "" || $debug == "" || $build == "" || $template == "") {
    exit(1);
}
// Get and increment the version number of the DB
$conn = ConnectVersionDB();
$version = GetVersion($conn, $product);
$version = IncrementVersion($version, $major, $minor, $debug, $build);
SetVersion($conn, $product, $version);
// Build the response
$template = str_replace("\\\"", "\"", $template);
$response = str_replace("VERSION", $version, $template);
// Add the new build to the database
AddVersionBuild($conn, $product, $version, $user, $machine, $changeset, $checked_out, $response);
// Return the response
echo $response;
?>