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

Report de r16647

Le critere age_redac n'etait pas pris en compte pour une base externe (B. Gugger).
En fait c'est plus general que ca, c'est vrai aussi pour le titre implicite.
Correctif a tester intensivement
parent efc42aaf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -130,11 +130,14 @@ function base_trouver_table_dist($nom, $serveur='', $table_spip = true){ ...@@ -130,11 +130,14 @@ function base_trouver_table_dist($nom, $serveur='', $table_spip = true){
// pour ne pas faire de boucle infinie, on stocke ce qu'on a deja trouve // pour ne pas faire de boucle infinie, on stocke ce qu'on a deja trouve
$connexion['tables'][$nom] = $desc; $connexion['tables'][$nom] = $desc;
$table = table_objet(objet_type($nom)); $surnom = (strpos($nom, $connexion['prefixe']) === 0) ? substr($nom, strlen($connexion['prefixe'])+1) : $nom;
$table = table_objet(objet_type($surnom));
$desc['titre'] = $desc['titre'] =
isset($GLOBALS['table_titre'][$table]) ? $GLOBALS['table_titre'][$table] : ''; isset($GLOBALS['table_titre'][$table]) ? $GLOBALS['table_titre'][$table] : '';
$desc['date'] =
isset($GLOBALS['table_date'][$table]) ? $GLOBALS['table_date'][$table] : '';
$connexion['tables'][$nom] = $desc; $connexion['tables'][$nom] = $desc;
// une nouvelle table a ete descrite // une nouvelle table a ete decrite
// mettons donc a jour le cache des descriptions de ce serveur // mettons donc a jour le cache des descriptions de ce serveur
if (is_writeable(_DIR_CACHE)) if (is_writeable(_DIR_CACHE))
ecrire_fichier($nom_cache_desc_sql[$serveur],serialize($connexion['tables'])); ecrire_fichier($nom_cache_desc_sql[$serveur],serialize($connexion['tables']));
......
...@@ -1009,8 +1009,9 @@ function calculer_critere_infixe($idb, &$boucles, $crit) { ...@@ -1009,8 +1009,9 @@ function calculer_critere_infixe($idb, &$boucles, $crit) {
} }
// Cas particulier : expressions de date // Cas particulier : expressions de date
else if ($date = tester_param_date($boucle->type_requete, $col)) { else if ($d = si_critere_date($boucle)
$col = calculer_critere_infixe_date($idb, $boucles, $date); AND preg_match(",^((age|jour|mois|annee)_relatif|date|mois|annee|jour|heure|age)(_[a-z]+)?$,", $col, $regs)) {
$col = calculer_critere_infixe_date($idb, $boucles, $regs, $d);
$table = ''; $table = '';
} }
else if (preg_match('/^(.*)\.(.*)$/', $col, $r)) { else if (preg_match('/^(.*)\.(.*)$/', $col, $r)) {
...@@ -1281,12 +1282,11 @@ function calculer_vieux_in($params) ...@@ -1281,12 +1282,11 @@ function calculer_vieux_in($params)
} }
// http://doc.spip.org/@calculer_critere_infixe_date // http://doc.spip.org/@calculer_critere_infixe_date
function calculer_critere_infixe_date($idb, &$boucles, $regs) function calculer_critere_infixe_date($idb, &$boucles, $regs, $date_orig)
{ {
global $table_date;
$boucle = $boucles[$idb]; $boucle = $boucles[$idb];
$col = $regs[1]; $col = $regs[1];
$date_orig = $pred = isset($table_date[$boucle->type_requete])?$table_date[$boucle->type_requete]:'date'; $pred = $date_orig;
if (isset($regs[3]) AND $suite=$regs[3]) { if (isset($regs[3]) AND $suite=$regs[3]) {
# Recherche de l'existence du champ date_xxxx, # Recherche de l'existence du champ date_xxxx,
# si oui choisir ce champ, sinon choisir xxxx # si oui choisir ce champ, sinon choisir xxxx
...@@ -1381,14 +1381,11 @@ function calculer_param_date($date_compare, $date_orig) { ...@@ -1381,14 +1381,11 @@ function calculer_param_date($date_compare, $date_orig) {
")))"; ")))";
} }
// http://doc.spip.org/@tester_param_date function si_critere_date($boucle)
function tester_param_date($type, $col)
{ {
global $table_date; $trouver_table = charger_fonction('trouver_table', 'base');
if (isset($table_date[$type]) $table = $trouver_table($boucle->type_requete, $boucle->sql_serveur);
AND preg_match(",^((age|jour|mois|annee)_relatif|date|mois|annee|jour|heure|age)(_[a-z]+)?$,", $col, $regs)) return $table['date'];
return $regs;
else return false;
} }
?> ?>
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