Skip to content
Extraits de code Groupes Projets
Valider eaa2a09f rédigé par cerdic's avatar cerdic
Parcourir les fichiers

report de [14757] [14758] [14762] [14763] [14764]

parent 8a4f901c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -596,6 +596,7 @@ function _chemin($dir_path=NULL){ ...@@ -596,6 +596,7 @@ function _chemin($dir_path=NULL){
if (strlen($GLOBALS['dossier_squelettes'])) if (strlen($GLOBALS['dossier_squelettes']))
foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d)
array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/'); array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/');
$GLOBALS['path_sig'] = md5(serialize($path_full));
} }
if ($dir_path===NULL) return $path_full; if ($dir_path===NULL) return $path_full;
...@@ -620,6 +621,7 @@ function _chemin($dir_path=NULL){ ...@@ -620,6 +621,7 @@ function _chemin($dir_path=NULL){
foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d)
array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/'); array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/');
$GLOBALS['path_sig'] = md5(serialize($path_full));
return $path_full; return $path_full;
} }
...@@ -628,14 +630,6 @@ function creer_chemin() { ...@@ -628,14 +630,6 @@ function creer_chemin() {
$path_a = _chemin(); $path_a = _chemin();
static $c = ''; static $c = '';
// provisoire, a remplacer par un spip_unlink sur les fichiers compiles lors d'un prochain upgrade
if (isset($GLOBALS['plugins'])){
$c = '';
foreach($GLOBALS['plugins'] as $dir) {
$path_base = _chemin(_DIR_PLUGINS.$dir);
}
unset($GLOBALS['plugins']);
}
// on calcule le chemin si le dossier skel a change // on calcule le chemin si le dossier skel a change
if ($c != $GLOBALS['dossier_squelettes']) { if ($c != $GLOBALS['dossier_squelettes']) {
// assurer le non plantage lors de la montee de version : // assurer le non plantage lors de la montee de version :
...@@ -695,20 +689,30 @@ function chemin_image($icone){ ...@@ -695,20 +689,30 @@ function chemin_image($icone){
// si on donne un sous-repertoire en 2e arg optionnel, il FAUT le / final // si on donne un sous-repertoire en 2e arg optionnel, il FAUT le / final
// si 3e arg vrai, on inclut si ce n'est fait. // si 3e arg vrai, on inclut si ce n'est fait.
define('_ROOT_CWD', getcwd().'/'); define('_ROOT_CWD', getcwd().'/');
$GLOBALS['path_sig'] = '';
$GLOBALS['path_files'] = null; $GLOBALS['path_files'] = null;
// http://doc.spip.org/@find_in_path // http://doc.spip.org/@find_in_path
function find_in_path ($file, $dirname='', $include=false) { function find_in_path ($file, $dirname='', $include=false) {
static $dirs=array(); static $dirs=array();
static $inc = array(); # cf http://trac.rezo.net/trac/spip/changeset/14743 static $inc = array(); # cf http://trac.rezo.net/trac/spip/changeset/14743
if (isset($GLOBALS['path_files'][$dirname][$file])) { static $c = '';
if (!$GLOBALS['path_files'][$dirname][$file])
// on calcule le chemin si le dossier skel a change
if ($c != $GLOBALS['dossier_squelettes']){
// assurer le non plantage lors de la montee de version :
$c = $GLOBALS['dossier_squelettes'];
creer_chemin(); // forcer un recalcul du chemin et la mise a jour de path_sig
}
if (isset($GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file])) {
if (!$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file])
return false; return false;
if ($include AND !isset($inc[$dirname][$file])) { if ($include AND !isset($inc[$dirname][$file])) {
include_once _ROOT_CWD . $GLOBALS['path_files'][$dirname][$file]; include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
$inc[$dirname][$file] = $inc[''][$dirname . $file] = true; $inc[$dirname][$file] = $inc[''][$dirname . $file] = true;
} }
return $GLOBALS['path_files'][$dirname][$file]; return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
} }
$a = strrpos($file,'/'); $a = strrpos($file,'/');
...@@ -728,7 +732,7 @@ function find_in_path ($file, $dirname='', $include=false) { ...@@ -728,7 +732,7 @@ function find_in_path ($file, $dirname='', $include=false) {
} }
if (!defined('_SAUVER_CHEMIN')) if (!defined('_SAUVER_CHEMIN'))
define('_SAUVER_CHEMIN',true); define('_SAUVER_CHEMIN',true);
return $GLOBALS['path_files'][$dirname][$file] = $GLOBALS['path_files'][''][$dirname . $file] = $a; return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a;
} }
} }
} }
...@@ -747,7 +751,7 @@ function find_in_path ($file, $dirname='', $include=false) { ...@@ -747,7 +751,7 @@ function find_in_path ($file, $dirname='', $include=false) {
if (!defined('_SAUVER_CHEMIN')) if (!defined('_SAUVER_CHEMIN'))
define('_SAUVER_CHEMIN',true); define('_SAUVER_CHEMIN',true);
return $GLOBALS['path_files'][$dirname][$file] = $GLOBALS['path_files'][''][$dirname . $file] = false; return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false;
} }
function load_path_cache(){ function load_path_cache(){
...@@ -756,7 +760,9 @@ function load_path_cache(){ ...@@ -756,7 +760,9 @@ function load_path_cache(){
// on ne recharge pas le cache pour forcer sa mise a jour // on ne recharge pas le cache pour forcer sa mise a jour
// le cache de chemin n'est utilise que dans le public // le cache de chemin n'est utilise que dans le public
if (_DIR_RESTREINT if (_DIR_RESTREINT
AND (!isset($GLOBALS['visiteur_statut']) OR $GLOBALS['visiteur_statut']!='0minirezo')){ //AND (!isset($GLOBALS['visiteur_session']['statut']) OR $GLOBALS['visiteur_session']['statut']!='0minirezo')
AND !isset($_COOKIE[$GLOBALS['cookie_prefix'].'_admin'])
){
lire_fichier(_CACHE_CHEMIN,$contenu); lire_fichier(_CACHE_CHEMIN,$contenu);
if (!$GLOBALS['path_files']=unserialize($contenu)) if (!$GLOBALS['path_files']=unserialize($contenu))
$GLOBALS['path_files'] = array(); $GLOBALS['path_files'] = array();
......
...@@ -259,7 +259,8 @@ function public_cacher_dist($contexte, &$use_cache, &$chemin_cache, &$page, &$la ...@@ -259,7 +259,8 @@ function public_cacher_dist($contexte, &$use_cache, &$chemin_cache, &$page, &$la
|| isset($_COOKIE['spip_admin']) || isset($_COOKIE['spip_admin'])
|| @file_exists(_ACCESS_FILE_NAME)) || @file_exists(_ACCESS_FILE_NAME))
) { ) {
supprimer_fichier(_DIR_CACHE . $f); $page = array(); // ignorer le cache deja lu
supprimer_fichier(_DIR_CACHE . $f); // pas necessaire ?
if (in_array($GLOBALS['var_mode'], array('calcul', 'recalcul')) if (in_array($GLOBALS['var_mode'], array('calcul', 'recalcul'))
AND $fs) { AND $fs) {
include_spip('inc/invalideur'); include_spip('inc/invalideur');
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter