From e7b4d34bc9538f4b4815b9df06003519e04f72f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2011 20:59:35 +0000 Subject: [PATCH] Perf: Speed enhancement. File can be saved into cache. --- htdocs/admin/menus/menu.js.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/menus/menu.js.php b/htdocs/admin/menus/menu.js.php index c73e94cb31e..0043388efc3 100644 --- a/htdocs/admin/menus/menu.js.php +++ b/htdocs/admin/menus/menu.js.php @@ -34,13 +34,24 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); +session_cache_limiter( FALSE ); require_once("../../master.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); -if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php -$langs->load("main",0,0); // We need to load direction but also content to translate 'ExpandAll' +// Define css type +header('Content-type: application/javascript'); +// Important: Following code is to avoid page request by browser and PHP CPU at +// each Dolibarr page access. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); +else header('Cache-Control: no-cache'); +// On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. +if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } + +if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL +if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"]; // If theme was forced on URL +$langs->load("main",0,0); ?>