2013-05-03 17:02:53 +02:00
|
|
|
<?php
|
2013-05-16 03:16:56 +02:00
|
|
|
/**
|
|
|
|
* PHPCI - Continuous Integration for PHP
|
|
|
|
*
|
2013-05-16 03:57:02 +02:00
|
|
|
* @copyright Copyright 2013, Block 8 Limited.
|
|
|
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
|
|
|
* @link http://www.phptesting.org/
|
2013-05-16 03:16:56 +02:00
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-05-15 23:29:09 +02:00
|
|
|
// Let PHP take a guess as to the default timezone, if the user hasn't set one:
|
2013-05-15 19:27:13 +02:00
|
|
|
date_default_timezone_set(@date_default_timezone_get());
|
|
|
|
|
2013-05-15 23:29:09 +02:00
|
|
|
// Set up a basic autoloader for PHPCI:
|
2013-05-16 03:57:02 +02:00
|
|
|
$autoload = function ($class) {
|
|
|
|
$file = str_replace(array('\\', '_'), '/', $class);
|
|
|
|
$file .= '.php';
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-05-16 03:57:02 +02:00
|
|
|
if (substr($file, 0, 1) == '/') {
|
|
|
|
$file = substr($file, 1);
|
|
|
|
}
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-05-16 03:57:02 +02:00
|
|
|
if (is_file(dirname(__FILE__) . '/' . $file)) {
|
|
|
|
include(dirname(__FILE__) . '/' . $file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
};
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-05-16 03:57:02 +02:00
|
|
|
spl_autoload_register($autoload, true, true);
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-12-04 12:18:56 +01:00
|
|
|
if (!file_exists(dirname(__FILE__) . '/PHPCI/config.yml') && (!defined('PHPCI_IS_CONSOLE') || !PHPCI_IS_CONSOLE) && substr($_SERVER['PHP_SELF'], -12) != '/install.php') {
|
2013-10-15 15:14:52 +02:00
|
|
|
header('Location: install.php');
|
|
|
|
die;
|
|
|
|
}
|
2013-05-03 17:02:53 +02:00
|
|
|
|
2013-10-15 15:14:52 +02:00
|
|
|
if (!file_exists(dirname(__FILE__) . '/vendor/autoload.php') && defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) {
|
|
|
|
file_put_contents('php://stderr', 'Please install PHPCI with "composer install" before using console');
|
|
|
|
exit(1);
|
2013-10-07 13:58:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-15 23:29:09 +02:00
|
|
|
// Load Composer autoloader:
|
2013-10-10 02:01:06 +02:00
|
|
|
require_once(dirname(__FILE__) . '/vendor/autoload.php');
|
2013-05-15 20:37:56 +02:00
|
|
|
|
2013-05-15 23:29:09 +02:00
|
|
|
// Load configuration if present:
|
2013-05-23 13:10:01 +02:00
|
|
|
$conf = array();
|
|
|
|
$conf['b8']['app']['namespace'] = 'PHPCI';
|
2013-09-20 08:33:46 +02:00
|
|
|
$conf['b8']['app']['default_controller'] = 'Home';
|
2013-05-23 13:10:01 +02:00
|
|
|
$conf['b8']['view']['path'] = dirname(__FILE__) . '/PHPCI/View/';
|
|
|
|
|
2013-10-19 16:49:52 +02:00
|
|
|
if (file_exists(dirname(__FILE__) . '/PHPCI/config.yml')) {
|
|
|
|
$config = new b8\Config($conf);
|
|
|
|
$config->loadYaml(dirname(__FILE__) . '/PHPCI/config.yml');
|
|
|
|
}
|
2013-05-22 17:36:55 +02:00
|
|
|
|
2013-10-10 02:01:06 +02:00
|
|
|
require_once(dirname(__FILE__) . '/vars.php');
|