diff --git a/gamutable_fonctions.php b/gamutable_fonctions.php index 30b21d4..f9f460c 100644 --- a/gamutable_fonctions.php +++ b/gamutable_fonctions.php @@ -14,6 +14,33 @@ if (!defined("_ECRIRE_INC_VERSION")) { } include_spip("inc/vite"); +/** + * fonction pour forcer un hit pour un objet + * un hit => maj de champ maj + * + * @param string $objet + * @param int $id_objet + * @param string $table (optional) pour forcer sur une table spécifique ou le test se fait sur la cle primaire de $objet + * si $table est renseigné : ex : + * $objet = rubrique + * $id_objet = 4 + * $table = 'spip_articles' + * => le hit sur l'id_rubrique 4 de spip_articles + * + * @return void [TODO:description] + */ +function forcer_hit(string $objet, int $id_objet, string $table = null):void { + include_spip('inc/invalideur'); + $id = id_table_objet($objet); + if (!$table) { + $table = table_objet_sql($objet); + } else { + $id_c = id_table_objet($table); + suivre_invalideur("id='$id_c/1'"); + } + sql_updateq($table, ['maj' => date("Y-m-d H:i:s")], "$id=".$id_objet); + suivre_invalideur("id='$id/1'"); +} if (!function_exists('tsEnDate')) { /** diff --git a/paquet.xml b/paquet.xml index 4d18fc7..b91015c 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@