More work on WordPress style installer
This commit is contained in:
parent
d2f41eb8be
commit
0b77222013
2 changed files with 37 additions and 15 deletions
|
@ -1,8 +1,18 @@
|
|||
<?php
|
||||
|
||||
|
||||
require_once(LIB_PATH . "propel/runtime/lib/Propel.php");
|
||||
|
||||
/**
|
||||
* Check to see if Airtime is properly configured.
|
||||
*
|
||||
* @return boolean true if all Airtime dependencies and services are
|
||||
* properly configured and running
|
||||
*/
|
||||
function airtimeCheckConfiguration() {
|
||||
return airtimeCheckDatabase()
|
||||
&& airtimeCheckDependencies();
|
||||
}
|
||||
|
||||
function airtimeCheckDependencies() {
|
||||
$deps = array();
|
||||
$deps["zend"] = file_exists('/usr/share/php/libzend-framework-php');
|
||||
|
@ -16,6 +26,8 @@ function airtimeCheckDependencies() {
|
|||
* @return boolean true if the database exists and is configured correctly, false otherwise
|
||||
*/
|
||||
function airtimeCheckDatabase() {
|
||||
airtimeConfigureDatabase();
|
||||
|
||||
if (!file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -32,7 +44,5 @@ function airtimeCheckDatabase() {
|
|||
}
|
||||
|
||||
function airtimeConfigureDatabase() {
|
||||
|
||||
Propel::init(APPLICATION_PATH . "/configs/airtime-conf-production.php");
|
||||
|
||||
}
|
|
@ -1,5 +1,18 @@
|
|||
<?php
|
||||
|
||||
global $configRun;
|
||||
|
||||
function showConfigCheckPage() {
|
||||
if (!isset($configRun) || !$configRun) {
|
||||
// This will run any necessary setup we need if
|
||||
// configuration hasn't been initialized
|
||||
airtimeCheckConfiguration();
|
||||
}
|
||||
|
||||
require_once(WEB_ROOT_PATH . 'config-check.php');
|
||||
die();
|
||||
}
|
||||
|
||||
define('ROOT_PATH', dirname( __DIR__) . '/');
|
||||
define('WEB_ROOT_PATH', __DIR__ . '/');
|
||||
define('LIB_PATH', ROOT_PATH . 'library/');
|
||||
|
@ -14,24 +27,23 @@ define('AIRTIME_CONFIG', 'airtime.conf');
|
|||
require_once(APPLICATION_PATH . "/configs/conf.php");
|
||||
require_once(BUILD_PATH . SETUP_DIR . 'load.php');
|
||||
|
||||
function showConfigCheckPage() {
|
||||
airtimeConfigureDatabase();
|
||||
|
||||
require_once(WEB_ROOT_PATH . 'config-check.php');
|
||||
die();
|
||||
}
|
||||
|
||||
if (array_key_exists('config', $_GET)) {
|
||||
showConfigCheckPage();
|
||||
}
|
||||
|
||||
// If a configuration file exists, forward to our boot script
|
||||
if (file_exists(BUILD_PATH . AIRTIME_CONFIG)) {
|
||||
airtimeConfigureDatabase();
|
||||
|
||||
// If the database doesn't exist, or is improperly configured,
|
||||
// show the user a configuration error page so they know what went wrong
|
||||
if (!airtimeCheckDatabase()) {
|
||||
/*
|
||||
* Even if the user has been through the setup process and
|
||||
* created an airtime.conf file (or they may have simply
|
||||
* copied the example file) their settings aren't necessarily
|
||||
* correctly configured.
|
||||
*
|
||||
* If something is improperly configured, show the user a
|
||||
* configuration checklist page so they know what went wrong
|
||||
*/
|
||||
if (!airtimeCheckConfiguration()) {
|
||||
$configRun = true;
|
||||
showConfigCheckPage();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue