mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 06:44:33 +02:00
Merge pull request #4391 from Icinga/improve-cache-handling
Improve cache handling
This commit is contained in:
commit
35659c8d51
@ -176,11 +176,22 @@ class ConfigController extends Controller
|
|||||||
|
|
||||||
$form = new ActionForm();
|
$form = new ActionForm();
|
||||||
$form->setOnSuccess(function (ActionForm $form) {
|
$form->setOnSuccess(function (ActionForm $form) {
|
||||||
$module = $form->getValue('identifier');
|
$moduleName = $form->getValue('identifier');
|
||||||
Icinga::app()->getModuleManager()->enableModule($module);
|
$module = Icinga::app()->getModuleManager()
|
||||||
Notification::success(sprintf($this->translate('Module "%s" enabled'), $module));
|
->enableModule($moduleName)
|
||||||
|
->getModule($moduleName);
|
||||||
|
Notification::success(sprintf($this->translate('Module "%s" enabled'), $moduleName));
|
||||||
$form->onSuccess();
|
$form->onSuccess();
|
||||||
$this->redirectHttp('config/modules');
|
|
||||||
|
if ($module->hasJs()) {
|
||||||
|
$this->redirectHttp('config/modules');
|
||||||
|
} else {
|
||||||
|
if ($module->hasCss()) {
|
||||||
|
$this->reloadCss();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->rerenderLayout()->redirectNow('config/modules');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -202,11 +213,22 @@ class ConfigController extends Controller
|
|||||||
|
|
||||||
$form = new ActionForm();
|
$form = new ActionForm();
|
||||||
$form->setOnSuccess(function (ActionForm $form) {
|
$form->setOnSuccess(function (ActionForm $form) {
|
||||||
$module = $form->getValue('identifier');
|
$mm = Icinga::app()->getModuleManager();
|
||||||
Icinga::app()->getModuleManager()->disableModule($module);
|
$moduleName = $form->getValue('identifier');
|
||||||
Notification::success(sprintf($this->translate('Module "%s" disabled'), $module));
|
$module = $mm->getModule($moduleName);
|
||||||
|
$mm->disableModule($moduleName);
|
||||||
|
Notification::success(sprintf($this->translate('Module "%s" disabled'), $moduleName));
|
||||||
$form->onSuccess();
|
$form->onSuccess();
|
||||||
$this->redirectHttp('config/modules');
|
|
||||||
|
if ($module->hasJs()) {
|
||||||
|
$this->redirectHttp('config/modules');
|
||||||
|
} else {
|
||||||
|
if ($module->hasCss()) {
|
||||||
|
$this->reloadCss();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->rerenderLayout()->redirectNow('config/modules');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -129,7 +129,7 @@ class JavaScript
|
|||||||
$request = Icinga::app()->getRequest();
|
$request = Icinga::app()->getRequest();
|
||||||
$noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
|
$noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
|
||||||
|
|
||||||
header('Cache-Control: public');
|
header('Cache-Control: public,no-cache,must-revalidate');
|
||||||
|
|
||||||
if (! $noCache && FileCache::etagMatchesFiles($files)) {
|
if (! $noCache && FileCache::etagMatchesFiles($files)) {
|
||||||
header("HTTP/1.1 304 Not Modified");
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
@ -192,7 +192,7 @@ class StyleSheet
|
|||||||
|
|
||||||
$request = $styleSheet->app->getRequest();
|
$request = $styleSheet->app->getRequest();
|
||||||
$response = $styleSheet->app->getResponse();
|
$response = $styleSheet->app->getResponse();
|
||||||
$response->setHeader('Cache-Control', 'public', true);
|
$response->setHeader('Cache-Control', 'private,no-cache,must-revalidate', true);
|
||||||
|
|
||||||
$noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
|
$noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
|
||||||
|
|
||||||
|
@ -111,10 +111,7 @@
|
|||||||
var $oldLink = $(this);
|
var $oldLink = $(this);
|
||||||
if ($oldLink.hasAttr('type') && $oldLink.attr('type').indexOf('css') > -1) {
|
if ($oldLink.hasAttr('type') && $oldLink.attr('type').indexOf('css') > -1) {
|
||||||
var base = location.protocol + '//' + location.host;
|
var base = location.protocol + '//' + location.host;
|
||||||
var url = icinga.utils.addUrlParams(
|
var url = $(this).attr('href');
|
||||||
$(this).attr('href'),
|
|
||||||
{ id: new Date().getTime() }
|
|
||||||
);
|
|
||||||
|
|
||||||
var $newLink = $oldLink.clone().attr(
|
var $newLink = $oldLink.clone().attr(
|
||||||
'href',
|
'href',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user