<?php

include_once ("_dirinfo.php");
include_once (PATH_TO_ROOT."init.php");
include_once (PATH_TO_ROOT."_class/class.liveupdate-warpit.php");

set_time_limit(0);

// because we are using curl to get and send files over port 80, curl must be installed
if (!function_exists('curl_init')) {
	echo "cURL library is not installed, please check your PHP configuration!";
	exit;
}

//$paths = configLoader::loadConfig('paths');
$current_propreties = configLoader::loadConfig('update');


$live = new liveupdateWarpit($db);

$live->SetServerAddress($current_propreties['warpit_server_www']);

$live->SetUserParameter($_GET);

$live->SetDatabaseConfig($dbConfig);

echo "<h1>Warpit Update informations</h1>";

if ($live->curl_getVersionControl($current_propreties)) {
	// their are new version on server which I need to download
	$live->doVersionUpdate();	

} else {
	// no update needed.
	echo "<p>Their is no update needed!!</p> ";
}


/*
// prepare all records needed for transfer and transfer them to server
$live->curl_sendToServer( $live->prepareLocalRecords() );
*/


?>