CC-3048: Install_minimal should check much sooner if Airtime is already installed

- fixed by creating new php file airtime-installed-check, which checks whether current version
of airtime exists; this file gets called right after root user check and whether debian
package exists check
- moved some code from airtime-install.php to AirtimeInstall.php as static functions
so that we reduce duplicated code
- both the new file airtime-installed-check.php and airtime-install.php use the new
static functions created above
This commit is contained in:
Yuchen Wang 2011-11-18 14:06:42 -05:00
parent c04e6dcc75
commit db82e51c30
4 changed files with 79 additions and 51 deletions

View file

@ -1,7 +1,9 @@
<?php
set_include_path(__DIR__.'/../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
require_once('Zend/Loader/Autoloader.php');
//Pear classes.
set_include_path(__DIR__.'/../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
require_once('DB.php');
require_once('pear/DB.php');
class AirtimeInstall
{
@ -467,4 +469,33 @@ class AirtimeInstall
exec("rm -f /usr/share/python-virtualenv/distribute-0.6.10.tar.gz");
}
}
public static function printUsage($opts)
{
$msg = $opts->getUsageMessage();
echo PHP_EOL."Usage: airtime-install [options]";
echo substr($msg, strpos($msg, "\n")).PHP_EOL;
}
public static function getOpts()
{
try {
$autoloader = Zend_Loader_Autoloader::getInstance();
$opts = new Zend_Console_Getopt(
array(
'help|h' => 'Displays usage information.',
'overwrite|o' => 'Overwrite any existing config files.',
'preserve|p' => 'Keep any existing config files.',
'no-db|n' => 'Turn off database install.',
'reinstall|r' => 'Force a fresh install of this Airtime Version'
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
print $e->getMessage() .PHP_EOL;
AirtimeInstall::printUsage($opts);
return NULL;
}
return $opts;
}
}