mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 22:13:13 +00:00
Update base and bootstrap
This commit is contained in:
@@ -8,10 +8,9 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
require_once __DIR__ . '/../Alchemy/Phrasea/Core.php';
|
||||
|
||||
use Alchemy\Phrasea\Core;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Alchemy\Phrasea\Loader\Autoloader;
|
||||
use Alchemy\Phrasea\Loader\CacheAutoloader;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -20,53 +19,62 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class bootstrap
|
||||
{
|
||||
protected static $core;
|
||||
protected static $autoloader_initialized;
|
||||
|
||||
public static function set_php_configuration()
|
||||
public static function register_autoloads($cacheAutoload = false)
|
||||
{
|
||||
return Core::initPHPConf();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $env
|
||||
* @return Alchemy\Phrasea\Core
|
||||
*/
|
||||
public static function execute($env = null)
|
||||
{
|
||||
if (static::$core) {
|
||||
return static::$core;
|
||||
if (static::$autoloader_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
static::$core = new Core($env);
|
||||
require_once __DIR__ . '/../Alchemy/Phrasea/Loader/Autoloader.php';
|
||||
require_once __DIR__ . '/../Alchemy/Phrasea/Loader/Autoloader.php';
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
if ($cacheAutoload === true) {
|
||||
try {
|
||||
require_once __DIR__ . '/../Alchemy/Phrasea/Loader/CacheAutoloader.php';
|
||||
|
||||
if ( ! ! stripos($request->server->get('HTTP_USER_AGENT'), 'flash') && $request->getRequestUri() === '/prod/upload/') {
|
||||
if (null !== $sessionId = $request->get('php_session_id')) {
|
||||
session_id($sessionId);
|
||||
$prefix = 'class_';
|
||||
$namespace = md5(__DIR__);
|
||||
|
||||
$loader = new CacheAutoloader($prefix, $namespace);
|
||||
} catch (\Exception $e) {
|
||||
//no op code cache available
|
||||
$loader = new Autoloader();
|
||||
}
|
||||
} else {
|
||||
$loader = new Autoloader();
|
||||
}
|
||||
|
||||
$getComposerNamespaces = function() {
|
||||
return require realpath(__DIR__ . '/../../vendor/composer/autoload_namespaces.php');
|
||||
};
|
||||
|
||||
foreach ($getComposerNamespaces() as $prefix => $path) {
|
||||
if (substr($prefix, -1) === '_' || $prefix == 'Pimple') {
|
||||
$loader->registerPrefix($prefix, $path);
|
||||
} else {
|
||||
$loader->registerNamespace($prefix, $path);
|
||||
}
|
||||
}
|
||||
|
||||
if (\setup::is_installed()) {
|
||||
$gatekeeper = \gatekeeper::getInstance(static::$core);
|
||||
$gatekeeper->check_directory($request);
|
||||
}
|
||||
$loader->registerNamespaces(array(
|
||||
'Entities' => realpath(__DIR__ . '/../Doctrine/'),
|
||||
'Repositories' => realpath(__DIR__ . '/../Doctrine/'),
|
||||
'Proxies' => realpath(__DIR__ . '/../Doctrine/'),
|
||||
'Doctrine\\Logger' => realpath(__DIR__ . '/../'),
|
||||
'Types' => realpath(__DIR__ . "/../Doctrine"),
|
||||
'PhraseaFixture' => realpath(__DIR__ . "/../conf.d"),
|
||||
));
|
||||
|
||||
return static::$core;
|
||||
}
|
||||
$loader->register();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Alchemy\Phrasea\Core
|
||||
*/
|
||||
public static function getCore()
|
||||
{
|
||||
return static::$core;
|
||||
}
|
||||
set_include_path(
|
||||
get_include_path() . PATH_SEPARATOR . realpath(__DIR__ . '/../../vendor/zend/gdata/library')
|
||||
);
|
||||
|
||||
public static function register_autoloads()
|
||||
{
|
||||
return Core::initAutoloads();
|
||||
static::$autoloader_initialized = true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user