Beispiel #1
0
 * GNU General Public license for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * @category	FluxBB
 * @package		Core
 * @copyright	Copyright (c) 2008-2012 FluxBB (http://fluxbb.org)
 * @license		http://www.gnu.org/licenses/gpl.html	GNU General Public License
 */
define('FLUXBB_VERSION', '2.0-alpha1');
Autoloader::namespaces(array('fluxbb' => __DIR__ . DS . 'classes'));
if (fluxbb\Core::installed()) {
    Request::set_env('fluxbb');
}
// Set up our custom session handler
if (!Request::cli() && !Session::started()) {
    Session::extend('fluxbb::session', function () {
        return new fluxbb\Session\Driver(Laravel\Database::connection());
    });
    Config::set('session.driver', 'fluxbb::session');
    Session::load();
}
// View composers
require 'helpers/composers.php';
// Route filters
require 'helpers/filters.php';
// HTML helpers
require 'helpers/html.php';
// Validators
require 'helpers/validator.php';
<?php

/**
 * @author Han Lin Yap < http://zencodez.net/ >
 * @copyright 2012 zencodez.net
 * @license http://creativecommons.org/licenses/by-sa/3.0/
 * @package Query Viewer (Laravel Bundle)
 * @version 1.2 - 2012-02-25
 */
Laravel\Routing\Route::filter('after', function ($response) {
    if ($_SERVER['LARAVEL_ENV'] == 'local') {
        $queries = Laravel\Database::profile();
        $count = 0;
        $sum = 0;
        $queries = array_map(function ($query) use(&$count, &$sum) {
            $sum += $query['time'];
            return ++$count . '. ' . $query['sql'] . PHP_EOL . implode(',', $query['bindings']) . PHP_EOL . 'Time: ' . $query['time'] . 'ms' . PHP_EOL . '---';
        }, $queries);
        $queries[] = 'Total time: ' . $sum . 'ms' . PHP_EOL . '---';
        $log_file = path('storage') . 'queries.txt';
        Laravel\File::append($log_file, implode(PHP_EOL, $queries) . PHP_EOL);
        if (Laravel\Input::has('debug-query')) {
            echo implode(PHP_EOL, $queries);
            die;
        }
    }
});
Beispiel #3
0
        $cache = IoC::resolve('doctrine::cache.provider');
    } else {
        $cache = new Doctrine\Common\Cache\ArrayCache();
    }
    /**
     * Register the cache provider with the Doctrine configuration.
     */
    $config = new Doctrine\ORM\Configuration();
    $config->setMetadataCacheImpl($cache);
    $config->setQueryCacheImpl($cache);
    /**
     * Resolve and register the meta-data driver.
     */
    if (IoC::registered('doctrine::metadata.driver')) {
        $driverImpl = IoC::resolve('doctrine::metadata.driver', array($config));
    } else {
        $driverImpl = $config->newDefaultAnnotationDriver(Config::get('doctrine::config.models'));
    }
    $config->setMetadataDriverImpl($driverImpl);
    /**
     * Register the proxy configuration with Doctrine.
     */
    $config->setProxyDir(Config::get('doctrine::config.proxy.directory'));
    $config->setProxyNamespace(Config::get('doctrine::config.proxy.namespace'));
    $config->setAutoGenerateProxyClasses(Config::get('doctrine::config.proxy.auto_generate'));
    /**
     * Register an EntityManager in the IoC container as an instance.
     */
    $em = EntityManager::create(array('pdo' => Laravel\Database::connection()->pdo), $config);
    IoC::instance('doctrine::manager', $em);
});