2010-11-04 23:01:31 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2011-01-05 23:44:23 +01:00
|
|
|
* @package Airtime
|
2011-04-16 00:23:51 +02:00
|
|
|
* @copyright 2011 Sourcefabric O.P.S.
|
2010-11-04 23:01:31 +01:00
|
|
|
* @license http://www.gnu.org/licenses/gpl.txt
|
|
|
|
*/
|
2011-04-16 00:23:51 +02:00
|
|
|
set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
2010-11-04 23:01:31 +01:00
|
|
|
|
2011-04-14 21:04:44 +02:00
|
|
|
echo PHP_EOL;
|
2011-03-30 00:32:53 +02:00
|
|
|
echo "******************************** Install Begin *********************************".PHP_EOL;
|
2010-11-04 23:01:31 +01:00
|
|
|
|
2011-03-30 18:01:26 +02:00
|
|
|
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
2011-04-12 19:59:08 +02:00
|
|
|
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
2011-05-19 20:27:30 +02:00
|
|
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/constants.php');
|
2011-02-10 01:45:22 +01:00
|
|
|
|
2011-04-12 19:59:08 +02:00
|
|
|
AirtimeInstall::ExitIfNotRoot();
|
2011-04-16 00:23:51 +02:00
|
|
|
|
2011-05-19 20:06:27 +02:00
|
|
|
$version = AirtimeInstall::CheckForVersionBeforeInstall();
|
2011-05-19 20:42:28 +02:00
|
|
|
|
2011-05-19 20:27:30 +02:00
|
|
|
require_once('Zend/Loader/Autoloader.php');
|
|
|
|
$autoloader = Zend_Loader_Autoloader::getInstance();
|
|
|
|
|
2011-04-16 00:23:51 +02:00
|
|
|
try {
|
|
|
|
$opts = new Zend_Console_Getopt(
|
|
|
|
array(
|
|
|
|
'help|h' => 'Displays usage information.',
|
|
|
|
'overwrite|o' => 'Overwrite any existing config files.',
|
2011-05-10 23:10:46 +02:00
|
|
|
'preserve|p' => 'Keep any existing config files.',
|
2011-05-20 17:22:46 +02:00
|
|
|
'no-db|n' => 'Turn off database install.',
|
|
|
|
'reinstall|r' => 'Force a fresh install of this Airtime Version'
|
2011-04-16 00:23:51 +02:00
|
|
|
)
|
|
|
|
);
|
|
|
|
$opts->parse();
|
2011-05-20 17:22:46 +02:00
|
|
|
}
|
|
|
|
catch (Zend_Console_Getopt_Exception $e) {
|
2011-04-16 00:23:51 +02:00
|
|
|
exit($e->getMessage() ."\n\n". $e->getUsageMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($opts->h)) {
|
|
|
|
echo $opts->getUsageMessage();
|
|
|
|
exit;
|
|
|
|
}
|
2011-05-20 17:22:46 +02:00
|
|
|
|
|
|
|
//a previous version exists.
|
|
|
|
if(isset($version) && $version != false && $version < AIRTIME_VERSION) {
|
|
|
|
|
|
|
|
echo "Airtime version $version found.".PHP_EOL;
|
|
|
|
|
|
|
|
$command = "php airtime-upgrade.php";
|
|
|
|
system($command);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2011-05-10 23:10:46 +02:00
|
|
|
$db_install = true;
|
2011-05-20 17:22:46 +02:00
|
|
|
if (is_null($opts->r) && isset($opts->n)){
|
2011-05-10 23:10:46 +02:00
|
|
|
$db_install = false;
|
|
|
|
}
|
2011-04-16 00:23:51 +02:00
|
|
|
|
|
|
|
$overwrite = false;
|
|
|
|
if (isset($opts->o)) {
|
|
|
|
$overwrite = true;
|
|
|
|
}
|
2011-05-20 17:22:46 +02:00
|
|
|
else if (!isset($opts->p) && !isset($opts->o) && isset($opts->r)) {
|
|
|
|
if (AirtimeIni::IniFilesExist()) {
|
2011-04-16 00:23:51 +02:00
|
|
|
$userAnswer = "x";
|
|
|
|
while (!in_array($userAnswer, array("o", "O", "p", "P", ""))) {
|
|
|
|
echo PHP_EOL."You have existing config files. Do you want to (O)verwrite them, or (P)reserve them? (o/P) ";
|
|
|
|
$userAnswer = trim(fgets(STDIN));
|
|
|
|
}
|
|
|
|
if (in_array($userAnswer, array("o", "O"))) {
|
|
|
|
$overwrite = true;
|
|
|
|
}
|
|
|
|
}
|
2011-04-18 23:15:51 +02:00
|
|
|
else {
|
2011-04-18 23:50:04 +02:00
|
|
|
$overwrite = true;
|
2011-04-18 23:15:51 +02:00
|
|
|
}
|
2011-04-16 00:23:51 +02:00
|
|
|
}
|
2011-04-18 23:50:04 +02:00
|
|
|
|
2011-04-16 00:23:51 +02:00
|
|
|
if ($overwrite) {
|
|
|
|
echo "* Creating INI files".PHP_EOL;
|
|
|
|
AirtimeIni::CreateIniFiles();
|
|
|
|
}
|
|
|
|
|
2011-04-15 00:55:04 +02:00
|
|
|
AirtimeInstall::InstallPhpCode();
|
|
|
|
AirtimeInstall::InstallBinaries();
|
|
|
|
|
2011-04-16 00:37:24 +02:00
|
|
|
if ($overwrite) {
|
|
|
|
echo "* Initializing INI files".PHP_EOL;
|
|
|
|
AirtimeIni::UpdateIniFiles();
|
|
|
|
}
|
2011-03-30 00:32:53 +02:00
|
|
|
|
2011-04-15 00:55:04 +02:00
|
|
|
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
2011-02-22 22:16:37 +01:00
|
|
|
|
2011-04-15 00:55:04 +02:00
|
|
|
echo "* Airtime Version: ".AIRTIME_VERSION.PHP_EOL;
|
2011-03-30 17:01:23 +02:00
|
|
|
|
2011-05-10 23:10:46 +02:00
|
|
|
if ($db_install) {
|
2011-05-20 17:22:46 +02:00
|
|
|
require_once('airtime-db-install.php');
|
2011-05-10 23:10:46 +02:00
|
|
|
}
|
2010-11-05 18:03:16 +01:00
|
|
|
|
2011-04-18 20:42:41 +02:00
|
|
|
AirtimeInstall::InstallStorageDirectory();
|
2010-11-05 18:03:16 +01:00
|
|
|
|
2011-03-16 18:21:40 +01:00
|
|
|
AirtimeInstall::ChangeDirOwnerToWebserver($CC_CONFIG["storageDir"]);
|
2010-11-04 23:01:31 +01:00
|
|
|
|
2011-04-18 21:28:48 +02:00
|
|
|
AirtimeInstall::CreateSymlinksToUtils();
|
2011-03-24 07:12:08 +01:00
|
|
|
|
2011-04-20 06:46:03 +02:00
|
|
|
AirtimeInstall::CreateZendPhpLogFile();
|
|
|
|
|
2011-03-09 06:44:51 +01:00
|
|
|
echo PHP_EOL."*** Pypo Installation ***".PHP_EOL;
|
2011-03-24 05:35:01 +01:00
|
|
|
system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py");
|
2011-03-09 06:44:51 +01:00
|
|
|
|
2011-03-22 23:20:22 +01:00
|
|
|
echo PHP_EOL."*** Recorder Installation ***".PHP_EOL;
|
|
|
|
system("python ".__DIR__."/../python_apps/show-recorder/install/recorder-install.py");
|
|
|
|
|
2011-05-18 20:22:45 +02:00
|
|
|
//wait for 1.9.0 release
|
2011-05-16 22:33:00 +02:00
|
|
|
//echo PHP_EOL."*** Media Monitor Installation ***".PHP_EOL;
|
|
|
|
//system("python ".__DIR__."/../python_apps/pytag-fs/install/media-monitor-install.py");
|
2011-04-25 18:49:01 +02:00
|
|
|
|
2011-03-09 06:44:51 +01:00
|
|
|
echo "******************************* Install Complete *******************************".PHP_EOL;
|
2011-02-22 18:22:31 +01:00
|
|
|
|