Browse Source

Abstraction manuelle de WHERE (DISTINCT est accepté par PG).

2.0
Committo,Ergo:sum 16 years ago
parent
commit
2531492a03
  1. 5
      ecrire/inc/afficher_objets.php
  2. 8
      ecrire/inc/rubriques.php

5
ecrire/inc/afficher_objets.php

@ -346,10 +346,9 @@ function inc_afficher_articles_dist($titre, $requete, $formater='') {
if (!isset($requete['GROUP BY'])) $requete['GROUP BY'] = '';
$cpt = sql_fetch(spip_query("SELECT COUNT(*) AS n FROM " . $requete['FROM'] . ($requete['WHERE'] ? (' WHERE ' . $requete['WHERE']) : '') . ($requete['GROUP BY'] ? (' GROUP BY ' . $requete['GROUP BY']) : '')));
if (!$cpt = $cpt['n']) return '' ;
$cpt = sql_countsel($requete['FROM'], $requete['WHERE'], $requete['GROUP BY']);
if (!$cpt) return '' ;
$requete['FROM'] = preg_replace("/(spip_articles( AS \w*)?)/", "\\1 LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete['FROM']);

8
ecrire/inc/rubriques.php

@ -275,17 +275,17 @@ function calculer_langues_utilisees () {
$langues[$GLOBALS['meta']['langue_site']] = 1;
$result = spip_query("SELECT DISTINCT lang FROM spip_articles WHERE statut='publie'");
$result = sql_select("DISTINCT lang", "spip_articles", "statut='publie'");
while ($row = sql_fetch($result)) {
$langues[$row['lang']] = 1;
}
$result = spip_query("SELECT DISTINCT lang FROM spip_breves WHERE statut='publie'");
$result = sql_select("DISTINCT lang", "spip_breves", "statut='publie'");
while ($row = sql_fetch($result)) {
$langues[$row['lang']] = 1;
}
$result = spip_query("SELECT DISTINCT lang FROM spip_rubriques WHERE statut='publie'");
$result = sql_select("DISTINCT lang", "spip_rubriques", "statut='publie'");
while ($row = sql_fetch($result)) {
$langues[$row['lang']] = 1;
}
@ -332,7 +332,7 @@ function calculer_prochain_postdate($check= false) {
$postdates = ($GLOBALS['meta']["post_dates"] == "non") ?
"AND A.date <= NOW()" : '';
$r = spip_query("SELECT DISTINCT A.id_rubrique AS id FROM spip_articles AS A LEFT JOIN spip_rubriques AS R ON A.id_rubrique=R.id_rubrique WHERE R.statut != 'publie' AND A.statut='publie'$postdates");
$r = sql_select("DISTINCT A.id_rubrique AS id", "spip_articles AS A LEFT JOIN spip_rubriques AS R ON A.id_rubrique=R.id_rubrique", "R.statut != 'publie' AND A.statut='publie'$postdates");
while ($row = sql_fetch($r))
publier_branche_rubrique($row['id']);
}

Loading…
Cancel
Save