This commit is contained in:
Simon Vieille 2018-08-20 16:40:04 +02:00
förälder 2d8f19437a
incheckning b7e6d8c69c
Ingen känd nyckel hittad för denna signaturen i databasen
GPG-nyckel ID: 919533E2B946EA10
6 ändrade filer med 20 tillägg och 3 borttagningar

1
.gitignore vendored
Visa fil

@ -11,3 +11,4 @@
/app/config/propel/
/data/
/trans/
/cache/

Visa fil

@ -26,6 +26,7 @@ update:
$(GIT) pull origin master
${MKDIR} -p data/git
${MKDIR} -p data/cache
$(COMPOSER) update
$(NPM) install

Visa fil

@ -9,6 +9,6 @@ $app->register(new TwigServiceProvider(), array(
$app->extend('twig', function ($twig, $app) {
$base = str_replace($app['request']->server->get('SCRIPT_NAME'), '', $app['request']->getBaseUrl());
$twig->addGlobal('web_path', $base.'/');
return $twig;
});

Visa fil

@ -0,0 +1,7 @@
<?php
use Silex\Provider\HttpCacheServiceProvider;
$app->register(new HttpCacheServiceProvider(), array(
'http_cache.cache_dir' => $app['root_path'].'/cache/',
));

Visa fil

@ -175,9 +175,17 @@ abstract class Controller
$params['user'] = $this->getUser();
}
return $app['twig']->render(
$body = $app['twig']->render(
$template,
$params
);
$response = new Response($body);
if (empty($params['no_cache'])) {
$response->setTtl(3600 * 24 * 7);
}
return $response;
}
}

Visa fil

@ -4,4 +4,4 @@ $app = require __DIR__.'/../app/bootstrap.php';
$app['env'] = 'prod';
$app->run();
$app['http_cache']->run();