/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-2017 *
+ * Copyright (c) 2001-2019 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
// Zend OPcache
if (function_exists('opcache_invalidate')) {
- opcache_invalidate($filepath, true);
+ $invalidate = @opcache_invalidate($filepath, true);
+ // si l'invalidation a echoue lever un flag
+ if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
+ define('_spip_attend_invalidation_opcode_cache',true);
+ }
}
// APC.
if (function_exists('apc_delete_file')) {
* @link http://wiki.mikejung.biz/PHP_OPcache
*
*/
-function spip_attend_invalidation_opcode_cache() {
+function spip_attend_invalidation_opcode_cache($timestamp = null) {
if (function_exists('opcache_get_configuration')
and @ini_get('opcache.enable')
and @ini_get('opcache.validate_timestamps')
and $duree = @ini_get('opcache.revalidate_freq')
+ and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees
) {
- spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s', _LOG_INFO_IMPORTANTE);
- sleep($duree + 1);
+ $wait = $duree + 1;
+ if ($timestamp) {
+ $wait -= (time() - $timestamp);
+ if ($wait<0) {
+ $wait = 0;
+ }
+ }
+ spip_log('Probleme de configuration opcache.revalidate_freq '. $duree .'s : on attend '.$wait.'s', _LOG_INFO_IMPORTANTE);
+ if ($wait) {
+ sleep($duree + 1);
+ }
}
}
$base = str_replace("//", "/", $base);
# suppr le dernier caractere si c'est un / ou un _
- $base = rtrim($base, '/_');
+ $base = rtrim($base, '/');
+ if (_CREER_DIR_PLAT) {
+ $base = rtrim($base, '_');
+ }
if (!strlen($subdir)) {
$n = strrpos($base, "/");
} else {
$base .= '/';
$subdir = str_replace("/", "", $subdir);
+ if (_CREER_DIR_PLAT) {
+ $subdir = rtrim($subdir, '_');
+ }
}
$baseaff = $nobase ? '' : $base;