[SPIP] ~v3.0.12-->3.0.13
[ptitvelo/web/www.git] / www / ecrire / inc / flock.php
index 271f662..9874bf9 100644 (file)
@@ -178,9 +178,13 @@ function ecrire_fichier ($fichier, $contenu, $ignorer_echec = false, $truncate=t
                        spip_fclose_unlock($fp);
                }
 
-       // liberer le verrou et fermer le fichier
+               // liberer le verrou et fermer le fichier
                @chmod($fichier, _SPIP_CHMOD & 0666);
-               if ($ok) return $ok;
+               if ($ok) {
+                       if (!defined('_OPCACHE_BUG') AND function_exists('opcache_invalidate'))
+                               opcache_invalidate($fichier, true);
+                       return $ok;
+               }
        }
 
        if (!$ignorer_echec){
@@ -284,6 +288,16 @@ function spip_unlink($f) {
        }
 }
 
+/**
+ * clearstatcache adapte a la version PHP
+ * @param bool $clear_realpath_cache
+ * @param null $filename
+ */
+function spip_clearstatcache($clear_realpath_cache = false, $filename=null){
+       return (version_compare(PHP_VERSION, '5.3.0') >= 0)?
+               clearstatcache($clear_realpath_cache,$filename):clearstatcache();
+}
+
 /*
  * Suppression complete d'un repertoire.
  *