本文整理汇总了PHP中AppKernel::loadClassCache方法的典型用法代码示例。如果您正苦于以下问题:PHP AppKernel::loadClassCache方法的具体用法?PHP AppKernel::loadClassCache怎么用?PHP AppKernel::loadClassCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKernel
的用法示例。
在下文中一共展示了AppKernel::loadClassCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildKernel
protected function buildKernel()
{
$this->kernel = new \AppKernel($this->environment->getType(), $this->environment->isDebug());
if ($this->loadClassCache) {
$this->kernel->loadClassCache();
}
if (true === (bool) $this->request->server->get('APP_CACHE', false)) {
$this->kernel = new \AppCache($this->kernel);
}
}
示例2: loadSf2
private function loadSf2()
{
global $kernel;
//@settings_fields('wp_symfony_settings');
//@do_settings_fields('wp_symfony_settings');
$path = get_option('symfony2_path');
$env = get_option('symfony2_env');
$url = get_option('symfony2_url');
if (!$this->isValidSymfonyPath($path)) {
add_action('admin_footer', array($this, 'symfony2_warning'));
return;
}
if ($kernel == null) {
$loader = (require_once $path . 'app/bootstrap.php.cache');
require_once $path . 'app/AppKernel.php';
$kernel = new AppKernel($env, true);
$kernel->loadClassCache();
$kernel->boot();
$this->kernel = $kernel;
$this->container = $kernel->getContainer();
if ($this->container->get('session')->isStarted() == false) {
$this->container->get('session')->start();
}
if ($url != null) {
$this->overloadUrlContext($url);
}
} else {
$this->kernel = $kernel;
$this->container = $kernel->getContainer();
}
$wp_loader = $this->container->get('wordpress.loader');
$wp_loader->load();
}
示例3: bootKernel
public static function bootKernel()
{
$loader = (require_once __DIR__ . '/../../../../app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/../../../../app/AppKernel.php';
$kernel = new \AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();
return $kernel;
}
示例4: getApplication
/**
* Create a Symfony application
*/
public function getApplication()
{
if (file_exists('./app/AppKernel.php')) {
require_once './app/AppKernel.php';
}
$this->includeAutoload();
$app = new \AppKernel($this->appenv, false);
$app->loadClassCache();
return $app;
}
示例5: passDataToApplication
function passDataToApplication($url)
{
$_SERVER['REQUEST_URI'] = modifyUrl($url);
$_GET['loggedAt'] = getLoggedAt();
require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$kernel->handle($request);
}
示例6: runApplication
public static function runApplication($env, $debug)
{
if (self::$_container) {
throw new \Exception();
}
$kernel = new AppKernel($env, $debug);
$kernel->loadClassCache();
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
\Dev::Bootstrap($kernel, $request);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
}
示例7: setServiceKernel
/**
* 每个testXXX执行之前,都会执行此函数,净化数据库。
*
* NOTE: 如果数据库已创建,那么执行清表操作,不重建。
*/
private function setServiceKernel()
{
$kernel = new \AppKernel('test', false);
$kernel->loadClassCache();
$kernel->boot();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
$serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
$serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
$currentUser = new CurrentUser();
$currentUser->fromArray(array('id' => 1, 'nickname' => 'admin', 'email' => 'admin@admin.com', 'password' => 'admin', 'currentIp' => '127.0.0.1', 'roles' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_TEACHER')));
$serviceKernel->setCurrentUser($currentUser);
$this->serviceKernel = $serviceKernel;
}
示例8: initialize
/**
* {@inheritdoc}
*/
public function initialize()
{
if (!file_exists($this->configuration->get('bootstrap'))) {
throw new MigraineException($this->configuration->get('bootstrap') . ' file not found');
}
if (!file_exists($this->configuration->get('kernel'))) {
throw new MigraineException($this->configuration->get('kernel') . ' file not found');
}
require_once $this->configuration->get('bootstrap');
require_once $this->configuration->get('kernel');
$kernel = new \AppKernel($this->configuration->get('env'), $this->configuration->get('debug'));
$kernel->loadClassCache();
$kernel->boot();
$class = get_class($kernel);
$this->version = $class::VERSION;
$this->container = $kernel->getContainer();
}
示例9: initialize
public function initialize(\Boris\Boris $boris, $dir)
{
parent::initialize($boris, $dir);
if (is_file("{$dir}/app/bootstrap.php.cache")) {
require "{$dir}/app/bootstrap.php.cache";
} else {
require "{$dir}/app/autoload.php";
}
require_once "{$dir}/app/AppKernel.php";
$kernel = new \AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();
$boris->onStart(function ($worker, $vars) use($kernel) {
$worker->setLocal('kernel', $kernel);
$worker->setLocal('container', $kernel->getContainer());
});
}
示例10: authenticate
public function authenticate(MOXMAN_Auth_User $user)
{
$config = MOXMAN::getConfig();
// Load environment and session logic
if (!$this->isSessionLoaded) {
$kernel = new AppKernel($config->get("SymfonyAuthenticator.environment", "prod"), false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$kernel->handle($request);
$this->isSessionLoaded = true;
}
// Get all session data
$session = new Session();
$session = $session->all();
// Check logged in key
$loggedInKey = $config->get("SymfonyAuthenticator.logged_in_key", "isLoggedIn");
$sessionValue = isset($session[$loggedInKey]) ? $session[$loggedInKey] : false;
if (!$sessionValue || $sessionValue === "false") {
return false;
}
// Extend config with session prefixed sessions
$sessionConfig = array();
$configPrefix = $config->get("SymfonyAuthenticator.config_prefix", "moxiemanager");
if ($configPrefix) {
foreach ($session as $key => $value) {
if (strpos($key, $configPrefix) === 0) {
$sessionConfig[substr($key, strlen($configPrefix) + 1)] = $value;
}
}
}
// Extend the config with the session config
$config->extend($sessionConfig);
// Replace ${user} with all config items
$key = $config->get("SessionAuthenticator.user_key", "user");
if ($key && isset($session[$key])) {
$config->replaceVariable("user", $session[$key]);
$user->setName($session[$key]);
}
return true;
}
示例11: registerSymfonyKernel
public function registerSymfonyKernel()
{
$kernel = self::$kernel;
$this[self::SYMFONY_KERNEL] = $this->share(function () use($kernel) {
if ($kernel) {
return $kernel;
}
/**
* @todo add support for setting environment dynamically
* Since this container does not use much environment dependent
* variables it doesn't really matter for now.
*/
$environment = getenv('SYMFONY_ENV');
if (!$environment) {
$environment = 'prod';
}
$kernel = new AppKernel($environment, true);
$kernel->loadClassCache();
$kernel->boot();
Request::createFromGlobals();
return $kernel;
});
}
示例12: _invoke
/**
* This is the same as invoke(), but it does *not* include exception
* handling.
*
* @param array $args
* The parts of the URL which identify the intended CiviCRM page
* (e.g. array('civicrm', 'event', 'register')).
* @return string
* HTML. For non-HTML content, invoke() may call print() and exit().
*/
public static function _invoke($args)
{
if ($args[0] !== 'civicrm') {
return NULL;
}
// CRM-15901: Turn off PHP errors display for all ajax calls
if (CRM_Utils_Array::value(1, $args) == 'ajax' || CRM_Utils_Array::value('snippet', $_REQUEST)) {
ini_set('display_errors', 0);
}
if (!defined('CIVICRM_SYMFONY_PATH')) {
// Traditional Civi invocation path
self::hackMenuRebuild($args);
// may exit
self::init($args);
self::hackStandalone($args);
$item = self::getItem($args);
return self::runItem($item);
} else {
// Symfony-based invocation path
require_once CIVICRM_SYMFONY_PATH . '/app/bootstrap.php.cache';
require_once CIVICRM_SYMFONY_PATH . '/app/AppKernel.php';
$kernel = new AppKernel('dev', TRUE);
$kernel->loadClassCache();
$response = $kernel->handle(Symfony\Component\HttpFoundation\Request::createFromGlobals());
if (preg_match(':^text/html:', $response->headers->get('Content-Type'))) {
// let the CMS handle the trappings
return $response->getContent();
} else {
$response->send();
exit;
}
}
}
示例13: AppKernel
<?php
use Symfony\Component\HttpFoundation\Request;
$loader = (require __DIR__ . '/../autoload.php');
require_once __DIR__ . '/kernel.php';
$app = new AppKernel('prod', false);
$app->loadClassCache();
$app->handle(Request::createFromGlobals())->send();
示例14: ApcClassLoader
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache('classes', '.php.cache');
$kernel = new AppCache($kernel);
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
示例15: AppKernel
<?php
//multisite
define('MULTISITE', 'awesome_SSM');
require_once __DIR__ . '/multisite.php';
//multisite.end
use Symfony\Component\HttpFoundation\Request;
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = (require __DIR__ . '/../app/autoload.php');
include_once __DIR__ . '/../var/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache(MULTISITE_DOMAIN);
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);