From 8f46b4dca7acda54780617e8695fad724317edaf Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Fri, 28 Nov 2014 15:30:11 -0500 Subject: [PATCH] More work on new installer --- airtime_mvc/application/Bootstrap.php | 22 ++- .../{public => application}/airtime-boot.php | 12 +- .../application/configs/config-check.php | 182 ++++++++++++++++++ airtime_mvc/build/airtime-setup/load.php | 70 +++++-- .../build/airtime-setup/setup-config.php | 16 ++ airtime_mvc/public/config-check.php | 107 ---------- .../bootstrap-3.3.1.min.css} | 0 airtime_mvc/public/index.php | 22 ++- 8 files changed, 279 insertions(+), 152 deletions(-) rename airtime_mvc/{public => application}/airtime-boot.php (84%) create mode 100644 airtime_mvc/application/configs/config-check.php delete mode 100644 airtime_mvc/public/config-check.php rename airtime_mvc/public/{bootstrap.3.3.1.min.css => css/bootstrap-3.3.1.min.css} (100%) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 465698b2e..9acf6f7f6 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -1,13 +1,17 @@ getResource('view'); - $view->addHelperPath('../application/views/helpers', 'Airtime_View_Helper'); + $view->addHelperPath(APPLICATION_PATH . 'views/helpers', 'Airtime_View_Helper'); } protected function _initTitle() diff --git a/airtime_mvc/public/airtime-boot.php b/airtime_mvc/application/airtime-boot.php similarity index 84% rename from airtime_mvc/public/airtime-boot.php rename to airtime_mvc/application/airtime-boot.php index cc0430f34..052755250 100644 --- a/airtime_mvc/public/airtime-boot.php +++ b/airtime_mvc/application/airtime-boot.php @@ -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 diff --git a/airtime_mvc/application/configs/config-check.php b/airtime_mvc/application/configs/config-check.php new file mode 100644 index 000000000..c5e940565 --- /dev/null +++ b/airtime_mvc/application/configs/config-check.php @@ -0,0 +1,182 @@ + + + + + + + + +

+
+ Configuration Checklist +

+ + + + + + + + +
+ Component + + Description + + Solution +
+ +
+ + + + + + + + + + + + + + +
+ PHP Dependencies +
+ Zend + + Zend MVC Framework + > + > + Ubuntu: try running sudo apt-get install libzend-framework-php +
Debian: try running sudo apt-get install zendframework + +
+ Postgres + + PDO and PostgreSQL libraries + > + > + Try running sudo apt-get install php5-pgsql + +
+ + + + + + + + + + +
+ External Services +
+ Database + + Database configuration for Airtime + > + > + 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 + airtime.conf is correct and the Airtime database was installed correctly. + +
+ +

+ Looks like something went wrong! If you've tried everything we've recommended in the table above, come + visit our forums + or check out the manual. +

+ +

+ Your Airtime station is up and running! +

+ +
+ + + 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'); } \ No newline at end of file diff --git a/airtime_mvc/build/airtime-setup/setup-config.php b/airtime_mvc/build/airtime-setup/setup-config.php index a4abe2daf..2bfa08e64 100644 --- a/airtime_mvc/build/airtime-setup/setup-config.php +++ b/airtime_mvc/build/airtime-setup/setup-config.php @@ -1,2 +1,18 @@ + + + + + + +
+
+

Database Settings

+ + + + + +
\ No newline at end of file diff --git a/airtime_mvc/public/config-check.php b/airtime_mvc/public/config-check.php deleted file mode 100644 index f877e77b6..000000000 --- a/airtime_mvc/public/config-check.php +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - -

- Airtime Configuration Checklist -

- - - - - - - - - - - - - - - - - - - - - -
- Airtime Configuration -
- Component - - Description - - Solution -
- Zend - - PHP MVC Framework - > - > - Ubuntu: try running sudo apt-get install libzend-framework-php -
Debian: try running sudo apt-get install zendframework - -
- Database - - PostgreSQL data store for Airtime - > - > - Try running sudo apt-get install php5-pgsql php5-mysql - -
- - -

- Looks like something went wrong! If you've tried everything we've recommended in the table above, come - visit our forums - or check out the manual. -

- -
-

- PHP Extension List -

-

- -

-