* @author Nicolas BROUSSE <*****@*****.**>
 */
/**
 * Load Required files
 */
require_once APPLICATION_BASE_URI . '/vendor/rrdtool/required.php';
require_once APPLICATION_BASE_URI . '/vendor/asker/required.php';
require_once APPLICATION_BASE_URI . '/vendor/yaml/lib/sfYaml.php';
/**
 * Initialize App
 */
$app = App::getInstance();
$app['version'] = APPLICATION_VERSION;
$app['name'] = "LightMonitor";
$app['debug'] = APPLICATION_ENV == 'development' ? true : false;
$app['config'] = App::loadConfigs(APPLICATION_BASE_URI . '/app/configs/', APPLICATION_ENV);
$app['config']->app['db']['path'] = APPLICATION_BASE_URI . $app['config']->app['db']['path'];
/**
 * Register Extensions
 */
$app->register(new Silex\Extension\TwigExtension(), array('twig.path' => APPLICATION_BASE_URI . '/app/views', 'twig.class_path' => APPLICATION_BASE_URI . '/vendor/twig/lib'));
$app->register(new Silex\Extension\SessionExtension());
$app->register(new Silex\Extension\MonologExtension(), array('monolog.logfile' => APPLICATION_BASE_URI . '/data/log/' . APPLICATION_ENV . '.App.log', 'monolog.class_path' => APPLICATION_BASE_URI . '/vendor/monolog/src', 'monolog.name' => 'App'));
$app['monolog.level'] = APPLICATION_ENV == 'development' ? \Monolog\Logger::DEBUG : \Monolog\Logger::WARNING;
$app->register(new Silex\Extension\UrlGeneratorExtension());
$app->register(new Rrdtool\RrdtoolExtension());
$app->register(new Asker\AskerExtension());
$app->register(new Silex\Extension\DoctrineExtension(), array('db.options' => $app['config']->app['db'], 'db.dbal.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-dbal/lib', 'db.common.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-common/lib'));
/**
 * Navigation
 */
            exit(0);
    }
} else {
    die('This file must be execute in CLI mode');
}
/**
 * Load required files
 */
require_once APPLICATION_BASE_URI . '/vendor/silex.phar';
require_once APPLICATION_BASE_URI . '/vendor/App.php';
require_once APPLICATION_BASE_URI . '/vendor/yaml/lib/sfYaml.php';
require_once APPLICATION_BASE_URI . '/vendor/rrdtool/required.php';
require_once APPLICATION_BASE_URI . '/vendor/asker/required.php';
require_once APPLICATION_BASE_URI . '/vendor/swiftmailer/lib/swift_required.php';
App::autoload(APPLICATION_BASE_URI . '/app/controllers/helpers/');
/**
 * Initialize new Application
 */
$app = App::getInstance('jobCron');
$config = App::loadConfigs(__DIR__ . '/../app/configs/', APPLICATION_ENV);
$config->app['db']['path'] = APPLICATION_BASE_URI . $config->app['db']['path'];
/**
 *  Register Extensions
 */
$app->register(new Silex\Extension\MonologExtension(), array('monolog.logfile' => APPLICATION_BASE_URI . '/data/log/development.jobCron.log', 'monolog.class_path' => APPLICATION_BASE_URI . '/vendor/monolog/src', 'monolog.name' => 'jobCron'));
$app['monolog.level'] = APPLICATION_ENV == 'development' ? \Monolog\Logger::DEBUG : \Monolog\Logger::WARNING;
$app['monolog']->addInfo("CLI EXEC : " . CLI_FILENAME);
$app->register(new Silex\Extension\DoctrineExtension(), array('db.options' => $config->app['db'], 'db.dbal.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-dbal/lib', 'db.common.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-common/lib'));
// TODO verify if DB exist, else duplicate emptyDB
$app->register(new Asker\AskerExtension());
$app->register(new Silex\Extension\SwiftmailerExtension(), array('swiftmailer.class_path' => APPLICATION_BASE_URI . '/vendor/swiftmailer/lib'));
示例#3
0
<?php

define('APPLICATION_BASE_URI', dirname(__DIR__) . '/');
require_once APPLICATION_BASE_URI . '/vendor/App.php';
require_once APPLICATION_BASE_URI . '/vendor/yaml/lib/sfYaml.php';
$config = App::loadConfigs(APPLICATION_BASE_URI . '/app/configs/', 'production');
$config->app['db']['path'] = APPLICATION_BASE_URI . $config->app['db']['path'];
return $config->app['db'];