2011-11-18 20:06:42 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Checks if a current version of Airtime is installed.
|
|
|
|
* If so, the user is presented with the help menu and can
|
|
|
|
* choose -r to reinstall.
|
2012-04-02 06:31:26 +02:00
|
|
|
*
|
2011-11-23 19:59:10 +01:00
|
|
|
* Returns 0 if Airtime is not installed
|
2011-11-30 23:59:00 +01:00
|
|
|
* Returns 1 if the same version of Airtime already installed
|
|
|
|
* Returns 2 if a previous version of Airtime is installed we can upgrade from
|
|
|
|
* Returns 3 if a version of Airtime is installed that we can't upgrade from.
|
2011-11-18 20:06:42 +01:00
|
|
|
*/
|
2012-04-02 06:31:26 +02:00
|
|
|
require_once(__DIR__.'/AirtimeInstall.php');
|
2011-11-18 20:06:42 +01:00
|
|
|
require_once(__DIR__.'/airtime-constants.php');
|
|
|
|
|
|
|
|
AirtimeInstall::ExitIfNotRoot();
|
|
|
|
|
2012-04-28 00:36:04 +02:00
|
|
|
if (!file_exists('/etc/airtime/airtime.conf')) {
|
2012-04-30 18:25:05 +02:00
|
|
|
#airtime.conf doesn't exist, and we need it to connect to database
|
|
|
|
#Assume Airtime is not installed.
|
2012-04-28 00:36:04 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-04-20 21:06:20 +02:00
|
|
|
require_once(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/db-conf.php");
|
2012-04-02 06:31:26 +02:00
|
|
|
require_once('propel/runtime/lib/Propel.php');
|
|
|
|
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
|
|
|
|
|
2011-11-18 20:06:42 +01:00
|
|
|
$version = AirtimeInstall::GetVersionInstalled();
|
2012-04-02 06:31:26 +02:00
|
|
|
|
2011-11-18 20:06:42 +01:00
|
|
|
// The current version is already installed.
|
2011-12-05 21:25:59 +01:00
|
|
|
echo "* Checking for existing Airtime installation...".PHP_EOL;
|
2011-11-30 23:59:00 +01:00
|
|
|
if (isset($version)){
|
2012-04-05 08:22:21 +02:00
|
|
|
if (is_null($version)){
|
2011-11-30 23:59:00 +01:00
|
|
|
//version of Airtime older than 1.7.0 detected
|
2012-04-02 06:31:26 +02:00
|
|
|
exit(3);
|
2011-11-30 23:59:00 +01:00
|
|
|
} else {
|
|
|
|
if (($version == AIRTIME_VERSION)) {
|
|
|
|
//same version of Airtime is already installed
|
|
|
|
exit(1);
|
|
|
|
} else if (strcmp($version, AIRTIME_VERSION) < 0){
|
|
|
|
//previous version of Airtime is installed.
|
|
|
|
exit(2);
|
|
|
|
}
|
2011-11-23 19:59:10 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-11-30 23:59:00 +01:00
|
|
|
//no previous version of Airtime found
|
|
|
|
exit(0);
|
2011-11-23 19:59:10 +01:00
|
|
|
}
|