/***************************************************************************\
* 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. *
// generer le fichier _CACHE_PIPELINE
pipeline_precompile($prepend_code);
- // attendre eventuellement l'invalidation du cache opcode
- spip_attend_invalidation_opcode_cache();
-
if (spip_connect()) {
// lancer et initialiser les nouveaux crons !
include_spip('inc/genie');
* @uses plugins_installer_dist()
**/
function plugin_installes_meta() {
+ if (isset($GLOBALS['fichier_php_compile_recent'])) {
+ // attendre eventuellement l'invalidation du cache opcode
+ spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']);
+ }
+
$installer_plugins = charger_fonction('installer', 'plugins');
$meta_plug_installes = array();
foreach (unserialize($GLOBALS['meta']['plugin']) as $prefix => $resume) {
* Commentaire : code écrit en tout début de fichier, après la balise PHP ouvrante
**/
function ecrire_fichier_php($nom, $contenu, $comment = '') {
- ecrire_fichier($nom,
- '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>');
+ if (!isset($GLOBALS['fichier_php_compile_recent'])) {
+ $GLOBALS['fichier_php_compile_recent'] = 0;
+ }
+
+ $contenu = '<' . '?php' . "\n" . $comment . "\nif (defined('_ECRIRE_INC_VERSION')) {\n" . $contenu . "}\n?" . '>';
+ // si un fichier existe deja on verifie que son contenu change avant de l'ecraser
+ // si pas de modif on ne touche pas au fichier initial
+ if (file_exists($nom)) {
+ if (substr($nom, -4) == '.php') {
+ $fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
+ }
+ else {
+ $fichier_tmp = $nom . '.tmp';
+ }
+ file_put_contents($fichier_tmp, $contenu);
+ if(md5_file($nom) == md5_file($fichier_tmp)) {
+ $GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
+ @unlink($fichier_tmp);
+ return;
+ }
+ @unlink($fichier_tmp);
+ }
+ ecrire_fichier($nom, $contenu);
+ $GLOBALS['fichier_php_compile_recent'] = max($GLOBALS['fichier_php_compile_recent'], filemtime($nom));
+ spip_clear_opcode_cache(realpath($nom));
}