diff --git a/ecrire/base/serial.php b/ecrire/base/serial.php index 767d0973df8de11676a3ad61e8d422d0d5d2814f..5aff7166cda7f2d04f1f32951e09d7fe4c762285 100644 --- a/ecrire/base/serial.php +++ b/ecrire/base/serial.php @@ -339,7 +339,6 @@ $spip_signatures_key = array( $spip_ajax_fonc = array( "id_ajax_fonc" => "bigint(21) NOT NULL", - "id_auteur" => "bigint(21) NOT NULL", "variables" => "text NOT NULL", "date" => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL", "`hash`" => "BIGINT UNSIGNED NOT NULL" ); diff --git a/ecrire/base/upgrade.php b/ecrire/base/upgrade.php index 753224a82fe51242d4112c1d2c8d763ba346f428..f296812dd8fa8e84afe17f36c360526b640be5a9 100644 --- a/ecrire/base/upgrade.php +++ b/ecrire/base/upgrade.php @@ -1208,6 +1208,11 @@ function maj_base($version_cible = 0) { maj_version(1.918); } + if (upgrade_vers(1.919, $version_installee, $version_cible)) { + spip_query("ALTER TABLE spip_ajax_fonc DROP id_auteur"); + maj_version(1.919); + } + } -?> \ No newline at end of file +?> diff --git a/ecrire/exec/memoriser.php b/ecrire/exec/memoriser.php index a64fadcdbeeb6e07297df3855a1d392b1b0b6de7..ea5cdbc6c1cce1e71a43c199870330bfe5ac042c 100644 --- a/ecrire/exec/memoriser.php +++ b/ecrire/exec/memoriser.php @@ -17,16 +17,16 @@ function exec_memoriser_dist() { $id_ajax = intval(_request('id_ajax_fonc')); - // le champ id_auteur sert finalement a memoriser le nombre de lignes - // (a renommer) - - $res = spip_fetch_array(spip_query($q = "SELECT variables, id_auteur, hash FROM spip_ajax_fonc WHERE id_ajax_fonc = $id_ajax")); + $res = spip_fetch_array(spip_query($q = "SELECT variables, hash FROM spip_ajax_fonc WHERE id_ajax_fonc = $id_ajax")); if ($res) { include_spip('inc/presentation'); list($t,$r,$p,$f) = unserialize($res["variables"]); - ajax_retour(afficher_articles_trad($t, $r, $f, $p, $id_ajax, $res['id_auteur'], _request('trad'))); + + $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM " . $r['FROM'] . ($r['WHERE'] ? (' WHERE ' . $r['WHERE']) : '') . ($r['GROUP BY'] ? (' GROUP BY ' . $r['GROUP BY']) : ''))); + + ajax_retour(afficher_articles_trad($t, $r, $f, $p, $id_ajax, $cpt['n'], _request('trad'))); } else spip_log("memoriser $q vide"); } diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index c218a7266465ed1173933de3f8fb27695ebaf90e..d87979fcb3512b83d7ce3daaf464e3fe44045933 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -680,36 +680,30 @@ function afficher_articles($titre, $requete, $formater_article='') { if (!isset($requete['GROUP BY'])) $requete['GROUP BY'] = ''; + $cpt = spip_fetch_array(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 '' ; + // memorisation des arguments pour gérer l'affichage par tranche // et/ou par langues. $hash = substr(md5(serialize($requete) . $GLOBALS['meta']['gerer_trad'] . $titre), 0, 31); $tmp_var = 't' . substr($hash, 0, 7); + $nb_aff = floor(1.5 * _TRANCHES); + $deb_aff = intval(_request($tmp_var)); - // le champ id_auteur sert finalement a memoriser le nombre de lignes - // (a renommer) - - $res_proch = spip_query("SELECT id_ajax_fonc, id_auteur FROM spip_ajax_fonc WHERE hash=0x$hash LIMIT 1"); + $res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=0x$hash LIMIT 1"); if ($row = spip_fetch_array($res_proch)) { $id_ajax = $row["id_ajax_fonc"]; - $cpt = $row["id_auteur"]; } else { - - $cpt = spip_fetch_array(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 '' ; - if (isset($requete['LIMIT'])) $cpt = min($requete['LIMIT'], $cpt); $v = serialize(array($titre, $requete, $tmp_var, $formater_article)); include_spip ('base/abstract_sql'); - $id_ajax = spip_abstract_insert("spip_ajax_fonc", "(variables, hash, id_auteur, date)", "(" . _q($v) . ", 0x$hash, $cpt, NOW())"); + $id_ajax = spip_abstract_insert("spip_ajax_fonc", "(variables, hash, date)", "(" . _q($v) . ", 0x$hash, NOW())"); } - $nb_aff = floor(1.5 * _TRANCHES); - $deb_aff = intval(_request($tmp_var)); - $requete['FROM'] = preg_replace("/(spip_articles AS \w*)/", "\\1 LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete['FROM']); $requete['SELECT'] .= ", petitions.id_article AS petition "; diff --git a/ecrire/inc_version.php b/ecrire/inc_version.php index ca379e6a7d654c768c984289ece7392b90f57f16..6405a84aad862c21fa4a30b9e7a7a0cf9ce15b8e 100644 --- a/ecrire/inc_version.php +++ b/ecrire/inc_version.php @@ -279,7 +279,7 @@ $tables_des_serveurs_sql['localhost'] = &$tables_principales; // (utilise pour les modifs de la base de donnees) // version de la base -$spip_version = 1.918; +$spip_version = 1.919; // version de spip en chaine // et en numerique a incrementer sur les evolutions qui cassent la compatibilite descendante