Fix pb with cache

This commit is contained in:
Laurent Destailleur 2021-12-13 09:35:27 +01:00
parent 388500794b
commit 49853adf82
7 changed files with 84 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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;
}

View File

@ -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 */

View File

@ -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 */