Forráskód Böngészése

Fix pb with cache

Laurent Destailleur 3 éve
szülő
commit
49853adf82

+ 12 - 0
htdocs/core/bookmarks_page.php

@@ -55,6 +55,18 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
  * View
  */
 
+// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+if (empty($dolibarr_nocache) && GETPOST('cache', 'int')) {
+	header('Cache-Control: max-age='.GETPOST('cache', 'int').', public');
+	// For a .php, we must set an Expires to avoid to have it forced to an expired value by the web server
+	header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + GETPOST('cache', 'int')).' GMT');
+	// HTTP/1.0
+	header('Pragma: token=public');
+} else {
+	// HTTP/1.0
+	header('Cache-Control: no-cache');
+}
+
 $title = $langs->trans("Bookmarks");
 
 // URL http://mydolibarr/core/bookmarks_page?dol_use_jmobile=1 can be used for tests

+ 12 - 0
htdocs/core/get_menudiv.php

@@ -81,6 +81,18 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
  * View
  */
 
+// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+if (empty($dolibarr_nocache) && GETPOST('cache', 'int')) {
+	header('Cache-Control: max-age='.GETPOST('cache', 'int').', public, must-revalidate');
+	// For a .php, we must set an Expires to avoid to have it forced to an expired value by the web server
+	header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + GETPOST('cache', 'int')).' GMT');
+	// HTTP/1.0
+	header('Pragma: token=public');
+} else {
+	// HTTP/1.0
+	header('Cache-Control: no-cache');
+}
+
 $title = $langs->trans("Menu");
 
 // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests

+ 2 - 6
htdocs/core/modules/modHRM.class.php

@@ -85,13 +85,9 @@ class modHRM extends DolibarrModules
 			// Set this to 1 if module has its own theme directory (theme)
 			'theme' => 0,
 			// Set this to relative path of css file if module has its own css file
-			'css' => array(
-				'/hrm/css/radio_js_number.css',
-			),
+			'css' => array(),
 			// Set this to relative path of js file if module must load a js on all pages
-			'js' => array(
-				//   '/hrm/js/hrm.js.php',
-			),
+			'js' => array(),
 
 			// Set this to 1 if features of module are opened to external users
 			'moduleforexternal' => 0,

+ 12 - 0
htdocs/core/search_page.php

@@ -55,6 +55,18 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
  * View
  */
 
+// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+if (empty($dolibarr_nocache) && GETPOST('cache', 'int')) {
+	header('Cache-Control: max-age='.GETPOST('cache', 'int').', public');
+	// For a .php, we must set an Expires to avoid to have it forced to an expired value by the web server
+	header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + GETPOST('cache', 'int')).' GMT');
+	// HTTP/1.0
+	header('Pragma: token=public');
+} else {
+	// HTTP/1.0
+	header('Cache-Control: no-cache');
+}
+
 $title = $langs->trans("Search");
 
 // URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests

+ 0 - 18
htdocs/hrm/css/radio_js_number.css

@@ -1,18 +0,0 @@
-.radio_js_bloc_number {
-	display:inline-block;
-	padding:5px 7px;
-	min-width:20px;
-	border-radius:3px;
-	border:1px solid #ccc;
-	background:#eee;
-	color:#555;
-	cursor:pointer;
-	margin:2px;
-	text-align:center;
-}
-.radio_js_bloc_number.selected {
-	transition:0.2s ease background;
-	background:#888;
-	color:#fff;
-	border-color:#555;
-}

+ 23 - 0
htdocs/theme/eldy/global.inc.php

@@ -6967,6 +6967,29 @@ div.clipboardCPValue.hidewithsize {
 }
 
 
+/* ============================================================================== */
+/* CSS style used for hrm skill/rank (may be we can remove this)                  */
+/* ============================================================================== */
+
+.radio_js_bloc_number {
+	display:inline-block;
+	padding:5px 7px;
+	min-width:20px;
+	border-radius:3px;
+	border:1px solid #ccc;
+	background:#eee;
+	color:#555;
+	cursor:pointer;
+	margin:2px;
+	text-align:center;
+}
+.radio_js_bloc_number.selected {
+	transition:0.2s ease background;
+	background:#888;
+	color:#fff;
+	border-color:#555;
+}
+
 
 /* ============================================================================== */
 /* CSS style used for small screen                                                */

+ 23 - 0
htdocs/theme/md/style.css.php

@@ -6854,6 +6854,29 @@ div.clipboardCPValue.hidewithsize {
 }
 
 
+/* ============================================================================== */
+/* CSS style used for hrm skill/rank (may be we can remove this)                  */
+/* ============================================================================== */
+
+.radio_js_bloc_number {
+	display:inline-block;
+	padding:5px 7px;
+	min-width:20px;
+	border-radius:3px;
+	border:1px solid #ccc;
+	background:#eee;
+	color:#555;
+	cursor:pointer;
+	margin:2px;
+	text-align:center;
+}
+.radio_js_bloc_number.selected {
+	transition:0.2s ease background;
+	background:#888;
+	color:#fff;
+	border-color:#555;
+}
+
 
 /* ============================================================================== */
 /* CSS style used for small screen                                                */