More work on new installer
This commit is contained in:
parent
0b77222013
commit
8f46b4dca7
|
@ -1,13 +1,17 @@
|
|||
<?php
|
||||
require_once __DIR__."/configs/conf.php";
|
||||
require_once CONFIG_PATH . "conf.php";
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
require_once __DIR__."/configs/ACL.php";
|
||||
require_once CONFIG_PATH . "ACL.php";
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
// Since we initialize the database during the configuration check,
|
||||
// check the $configRun global to avoid reinitializing unnecessarily
|
||||
if (!isset($configRun) || !$configRun) {
|
||||
Propel::init(CONFIG_PATH . 'airtime-conf-production.php');
|
||||
}
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once CONFIG_PATH . "constants.php";
|
||||
require_once 'Preference.php';
|
||||
require_once 'Locale.php';
|
||||
require_once "DateHelper.php";
|
||||
|
@ -15,14 +19,14 @@ require_once "OsPath.php";
|
|||
require_once "Database.php";
|
||||
require_once "Timezone.php";
|
||||
require_once "Auth.php";
|
||||
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
|
||||
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
|
||||
require_once __DIR__ . '/forms/helpers/ValidationTypes.php';
|
||||
require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php';
|
||||
|
||||
require_once (APPLICATION_PATH."/logging/Logging.php");
|
||||
require_once (APPLICATION_PATH . "logging/Logging.php");
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
||||
Config::setAirtimeVersion();
|
||||
require_once __DIR__."/configs/navigation.php";
|
||||
require_once (CONFIG_PATH . 'navigation.php');
|
||||
|
||||
Zend_Validate::setDefaultNamespaces("Zend");
|
||||
|
||||
|
@ -165,7 +169,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
protected function _initViewHelpers()
|
||||
{
|
||||
$view = $this->getResource('view');
|
||||
$view->addHelperPath('../application/views/helpers', 'Airtime_View_Helper');
|
||||
$view->addHelperPath(APPLICATION_PATH . 'views/helpers', 'Airtime_View_Helper');
|
||||
}
|
||||
|
||||
protected function _initTitle()
|
||||
|
|
|
@ -32,16 +32,16 @@ defined('VERBOSE_STACK_TRACE')
|
|||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
get_include_path(),
|
||||
realpath(APPLICATION_PATH . '/../library')
|
||||
realpath(LIB_PATH)
|
||||
)));
|
||||
|
||||
set_include_path(APPLICATION_PATH . '/common' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(APPLICATION_PATH . 'common' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Propel classes.
|
||||
set_include_path(APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(APPLICATION_PATH . 'models' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Controller plugins.
|
||||
set_include_path(APPLICATION_PATH . '/controllers/plugins' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(APPLICATION_PATH . 'controllers/plugins' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//Zend framework
|
||||
if (file_exists('/usr/share/php/libzend-framework-php')) {
|
||||
|
@ -52,10 +52,10 @@ if (file_exists('/usr/share/php/libzend-framework-php')) {
|
|||
require_once 'Zend/Application.php';
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
CONFIG_PATH . 'application.ini'
|
||||
);
|
||||
|
||||
require_once(APPLICATION_PATH . "/logging/Logging.php");
|
||||
require_once(APPLICATION_PATH . "logging/Logging.php");
|
||||
Logging::setLogPath('/var/log/airtime/zendphp.log');
|
||||
|
||||
// Create application, bootstrap, and run
|
|
@ -0,0 +1,182 @@
|
|||
<?php
|
||||
/*
|
||||
* We only get here after setup, or if there's an error in the configuration.
|
||||
*
|
||||
* Display a table to the user showing the necessary dependencies
|
||||
* (both PHP and binary) and the status of any application services,
|
||||
* along with steps to fix them if they're not found or misconfigured.
|
||||
*/
|
||||
|
||||
$phpDependencies = airtimeCheckPhpDependencies();
|
||||
$zend = $phpDependencies["zend"];
|
||||
$postgres = $phpDependencies["postgres"];
|
||||
$database = airtimeCheckDatabaseConfiguration();
|
||||
|
||||
function booleanReduce($a, $b) {
|
||||
return $a && $b;
|
||||
}
|
||||
|
||||
$r = array_reduce($phpDependencies, "booleanReduce", true);
|
||||
$result = $r && $database;
|
||||
|
||||
?>
|
||||
<html style="background-color: #f5f5f5">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css">
|
||||
<style>
|
||||
.checklist {
|
||||
overflow: auto;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.caption {
|
||||
padding-left: .5em;
|
||||
}
|
||||
|
||||
.component {
|
||||
font-weight: bold;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.description, .solution {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin: inherit;
|
||||
width: inherit;
|
||||
bottom: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="padding: 2em 0; min-width: 600px; width: 50%; text-align: center; margin: 3em auto;
|
||||
border: 1px solid lightgray; border-radius: 5em;">
|
||||
<h2>
|
||||
<img src="css/images/airtime_logo_jp.png" style="margin-bottom: .5em;" /><br/>
|
||||
<strong>Configuration Checklist</strong>
|
||||
</h2>
|
||||
<table class="table" style="padding: 0; margin: 3em 0 0 0; font-weight: bold">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="component">
|
||||
Component
|
||||
</td>
|
||||
<td class="description">
|
||||
Description
|
||||
</td>
|
||||
<td class="solution">
|
||||
Solution
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div class="checklist">
|
||||
<table class="table table-striped">
|
||||
<caption class="caption">
|
||||
PHP Dependencies
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr class="<?=$zend ? 'success' : 'danger';?>">
|
||||
<td class="component">
|
||||
Zend
|
||||
</td>
|
||||
<td class="description">
|
||||
Zend MVC Framework
|
||||
</td>
|
||||
<td class="solution" <?php if ($zend) {echo 'style="background: #dff0d8 url(css/images/accept.png) no-repeat center"';?>>
|
||||
<?php
|
||||
} else {
|
||||
?>>
|
||||
<b>Ubuntu</b>: try running <code>sudo apt-get install libzend-framework-php</code>
|
||||
<br/><b>Debian</b>: try running <code>sudo apt-get install zendframework</code>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?=$postgres ? 'success' : 'danger';?>">
|
||||
<td class="component">
|
||||
Postgres
|
||||
</td>
|
||||
<td class="description">
|
||||
PDO and PostgreSQL libraries
|
||||
</td>
|
||||
<td class="solution" <?php if ($postgres) {echo 'style="background: #dff0d8 url(css/images/accept.png) no-repeat center"';?>>
|
||||
<?php
|
||||
} else {
|
||||
?>>
|
||||
Try running <code>sudo apt-get install php5-pgsql</code>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="table table-striped">
|
||||
<caption class="caption">
|
||||
External Services
|
||||
</caption>
|
||||
<tbody>
|
||||
<tr class="<?=$database ? 'success' : 'danger';?>">
|
||||
<td class="component">
|
||||
Database
|
||||
</td>
|
||||
<td class="description">
|
||||
Database configuration for Airtime
|
||||
</td>
|
||||
<td class="solution" <?php if ($database) {echo 'style="background: #dff0d8 url(css/images/accept.png) no-repeat center"';?>>
|
||||
<?php
|
||||
} else {
|
||||
?>>
|
||||
Make sure you aren't missing any of the Postgres dependencies in the table above.
|
||||
If your dependencies check out, make sure your database configuration settings in
|
||||
<code>airtime.conf</code> is correct and the Airtime database was installed correctly.
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
if (!$result) {
|
||||
?>
|
||||
<p>
|
||||
Looks like something went wrong! If you've tried everything we've recommended in the table above, come
|
||||
<a href="https://forum.sourcefabric.org/">visit our forums</a>
|
||||
or <a href="http://www.sourcefabric.org/en/airtime/manuals/">check out the manual</a>.
|
||||
</p>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p>
|
||||
Your Airtime station is up and running!
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<h3>
|
||||
PHP Extension List
|
||||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
|
||||
if (!isset($extensions)) {
|
||||
$extensions = get_loaded_extensions();
|
||||
}
|
||||
|
||||
foreach ($extensions as $ext) {
|
||||
echo $ext . " | ";
|
||||
}
|
||||
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
|
@ -9,33 +9,60 @@ require_once(LIB_PATH . "propel/runtime/lib/Propel.php");
|
|||
* properly configured and running
|
||||
*/
|
||||
function airtimeCheckConfiguration() {
|
||||
return airtimeCheckDatabase()
|
||||
&& airtimeCheckDependencies();
|
||||
}
|
||||
|
||||
function airtimeCheckDependencies() {
|
||||
$deps = array();
|
||||
$deps["zend"] = file_exists('/usr/share/php/libzend-framework-php');
|
||||
|
||||
return $deps;
|
||||
return airtimeCheckPhpDependencies()
|
||||
&& airtimeCheckDatabaseConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the database exists and is configured correctly
|
||||
* Check for Airtime's PHP dependencies and return an associative
|
||||
* array with the results
|
||||
*
|
||||
* @return boolean true if the database exists and is configured correctly, false otherwise
|
||||
* @return array associative array of dependency check results
|
||||
*/
|
||||
function airtimeCheckDatabase() {
|
||||
function airtimeCheckPhpDependencies() {
|
||||
return array(
|
||||
"zend" => airtimeCheckMvcDependencies(),
|
||||
"postgres" => airtimeCheckDatabaseDependencies()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the Zend framework libraries are installed
|
||||
*
|
||||
* @return boolean true if Zend exists in /usr/share/php
|
||||
*/
|
||||
function airtimeCheckMvcDependencies() {
|
||||
return file_exists('/usr/share/php/libzend-framework-php')
|
||||
|| file_exists('/usr/share/php/zendframework'); // Debian version
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the PHP dependencies for the database exist
|
||||
*
|
||||
* @return boolean true if the database dependencies exist
|
||||
*/
|
||||
function airtimeCheckDatabaseDependencies() {
|
||||
if (!isset($extensions)) {
|
||||
$extensions = get_loaded_extensions();
|
||||
}
|
||||
// Check the PHP extension list for the Postgres db extensions
|
||||
return (in_array('pdo_pgsql', $extensions)
|
||||
&& in_array('pgsql', $extensions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the database configuration by fetching a connection from Propel
|
||||
*
|
||||
* @return boolean true if a connection is made to the database
|
||||
*/
|
||||
function airtimeCheckDatabaseConfiguration() {
|
||||
airtimeConfigureDatabase();
|
||||
|
||||
if (!file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$config = parse_ini_file(BUILD_PATH . AIRTIME_CONFIG, true);
|
||||
|
||||
try {
|
||||
Propel::getConnection($config["database"]["dbname"]);
|
||||
// Try to establish a database connection. If something goes
|
||||
// wrong, the database is improperly configured
|
||||
Propel::getConnection();
|
||||
Propel::close();
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
@ -43,6 +70,9 @@ function airtimeCheckDatabase() {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Propel to configure the Airtime database
|
||||
*/
|
||||
function airtimeConfigureDatabase() {
|
||||
Propel::init(APPLICATION_PATH . "/configs/airtime-conf-production.php");
|
||||
Propel::init(CONFIG_PATH . 'airtime-conf-production.php');
|
||||
}
|
|
@ -1,2 +1,18 @@
|
|||
<?php
|
||||
|
||||
?>
|
||||
|
||||
<html style="background-color:black;color:white;">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap-3.3.1.min.css">
|
||||
</head>
|
||||
<body style="padding: 2em 0; min-width: 400px; width: 30%; text-align: center; margin: 3em auto;">
|
||||
<img src="css/images/airtime_logo_jp.png" style="margin-bottom: .5em;" /><br/>
|
||||
<form>
|
||||
<h2>Database Settings</h2>
|
||||
<input type="text" placeholder="Username"/>
|
||||
<input type="password" placeholder="Password"/>
|
||||
<input type="text" placeholder="Name"/>
|
||||
<input type="text" placeholder="Host" value="localhost"/>
|
||||
<input type="submit" />
|
||||
</form>
|
|
@ -1,107 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
* We only get here after setup, or if there's an error in the configuration.
|
||||
*
|
||||
* Display a table to the user showing the necessary dependencies
|
||||
* (both PHP and binary) and the status of any application services,
|
||||
* along with steps to fix them if they're not found or misconfigured.
|
||||
*/
|
||||
|
||||
$phpDependencies = airtimeCheckDependencies();
|
||||
$zend = $phpDependencies["zend"];
|
||||
$database = airtimeCheckDatabase();
|
||||
|
||||
$result = $database;
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="bootstrap.3.3.1.min.css">
|
||||
</head>
|
||||
|
||||
<body style="padding: 2em 0; min-width: 500px; width: 50%; text-align: center; margin: 0 auto;">
|
||||
|
||||
<h1>
|
||||
Airtime Configuration Checklist
|
||||
</h1>
|
||||
<table class="table table-striped" style="text-align: center">
|
||||
<caption>
|
||||
Airtime Configuration
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
Component
|
||||
</td>
|
||||
<td>
|
||||
Description
|
||||
</td>
|
||||
<td>
|
||||
Solution
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="<?=$zend ? 'success' : 'danger';?>">
|
||||
<td>
|
||||
<strong>Zend</strong>
|
||||
</td>
|
||||
<td>
|
||||
PHP MVC Framework
|
||||
</td>
|
||||
<td <?php if ($zend) {echo 'style="background: #dff0d8 url(css/images/accept.png) no-repeat center"';?>>
|
||||
<?php
|
||||
} else {
|
||||
?>>
|
||||
<b>Ubuntu</b>: try running <code>sudo apt-get install libzend-framework-php</code>
|
||||
<br/><b>Debian</b>: try running <code>sudo apt-get install zendframework</code>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?=$database ? 'success' : 'danger';?>">
|
||||
<td>
|
||||
<strong>Database</strong>
|
||||
</td>
|
||||
<td>
|
||||
PostgreSQL data store for Airtime
|
||||
</td>
|
||||
<td <?php if ($database) {echo 'style="background: #dff0d8 url(css/images/accept.png) no-repeat center"';?>>
|
||||
<?php
|
||||
} else {
|
||||
?>>
|
||||
Try running <code>sudo apt-get install php5-pgsql php5-mysql</code>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
if (!$result) {
|
||||
?>
|
||||
<p>
|
||||
Looks like something went wrong! If you've tried everything we've recommended in the table above, come
|
||||
<a href="https://forum.sourcefabric.org/">visit our forums</a>
|
||||
or <a href="http://www.sourcefabric.org/en/airtime/manuals/">check out the manual</a>.
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br/>
|
||||
<h3>
|
||||
PHP Extension List
|
||||
</h3>
|
||||
<p>
|
||||
<?php
|
||||
|
||||
foreach (get_loaded_extensions() as $ext) {
|
||||
echo $ext . " | ";
|
||||
}
|
||||
|
||||
?>
|
||||
</p>
|
||||
<?php
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
global $configRun;
|
||||
global $extensions;
|
||||
|
||||
function showConfigCheckPage() {
|
||||
if (!isset($configRun) || !$configRun) {
|
||||
|
@ -9,24 +10,25 @@ function showConfigCheckPage() {
|
|||
airtimeCheckConfiguration();
|
||||
}
|
||||
|
||||
require_once(WEB_ROOT_PATH . 'config-check.php');
|
||||
require_once(CONFIG_PATH . 'config-check.php');
|
||||
die();
|
||||
}
|
||||
|
||||
// Define application path constants
|
||||
define('ROOT_PATH', dirname( __DIR__) . '/');
|
||||
define('WEB_ROOT_PATH', __DIR__ . '/');
|
||||
define('LIB_PATH', ROOT_PATH . 'library/');
|
||||
define('BUILD_PATH', ROOT_PATH . 'build/');
|
||||
define('SETUP_DIR', 'airtime-setup/');
|
||||
|
||||
// Define path to application directory
|
||||
define('APPLICATION_PATH', ROOT_PATH . 'application');
|
||||
define('SETUP_PATH', BUILD_PATH . 'airtime-setup/');
|
||||
define('APPLICATION_PATH', ROOT_PATH . 'application/');
|
||||
define('CONFIG_PATH', APPLICATION_PATH . 'configs/');
|
||||
|
||||
define('AIRTIME_CONFIG', 'airtime.conf');
|
||||
|
||||
require_once(APPLICATION_PATH . "/configs/conf.php");
|
||||
require_once(BUILD_PATH . SETUP_DIR . 'load.php');
|
||||
require_once(CONFIG_PATH . 'conf.php');
|
||||
require_once(SETUP_PATH . 'load.php');
|
||||
|
||||
// This allows us to pass ?config as a parameter to any page
|
||||
// and get to the config checklist.
|
||||
if (array_key_exists('config', $_GET)) {
|
||||
showConfigCheckPage();
|
||||
}
|
||||
|
@ -47,10 +49,10 @@ if (file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
|
|||
showConfigCheckPage();
|
||||
}
|
||||
|
||||
require_once(WEB_ROOT_PATH . 'airtime-boot.php');
|
||||
require_once(APPLICATION_PATH . 'airtime-boot.php');
|
||||
}
|
||||
// Otherwise, we'll need to run our configuration setup
|
||||
else {
|
||||
require_once(BUILD_PATH . SETUP_DIR . 'setup-config.php');
|
||||
require_once(SETUP_PATH . 'setup-config.php');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue