* Environment is now configurable ('prod' for production, 'dev' for development)

Significantly better load times with 'prod' !!!
This commit is contained in:
slawkens
2018-06-01 19:12:48 +02:00
parent 510459b046
commit 550b664a61
5 changed files with 32 additions and 6 deletions

View File

@@ -39,12 +39,17 @@ class Twig_Autoloader
*/
public static function autoload($class)
{
if (0 !== strpos($class, 'Twig')) {
if (0 !== strpos($class, 'Twig')) {// || !isset($class[0])) {
return;
}
if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {
require $file;
$file = __DIR__.'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php';
$dev_mode = (config('env') === 'dev');
if($dev_mode && !is_file($file)) {
return;
}
require $file;
}
}

View File

@@ -16,6 +16,10 @@ class Cache
static public function getInstance($engine = '', $prefix = '')
{
if(config('env') === 'dev') {
return new self();
}
if(!self::$instance) {
switch(strtolower($engine)) {
case 'apc':