From 3ff9387d535973046eabe141acdeb53d34cef56a Mon Sep 17 00:00:00 2001 From: x2000bedo Date: Sun, 15 Aug 2004 00:12:56 +0000 Subject: [PATCH] =?utf8?q?Scripts=20pour=20la=20reconstruction=20p=E9riodi?= =?utf8?q?que=20de=20la=20table=20de=20recherche=20am=E9lior=E9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Appeler : - recherche.pl 1 toutes les 24 h - recherche.pl 0 tous les 1/4 h Attention ! Bien penser à mettre le flag (/tmp/flag_recherche) à 1 quand on change nom ou prénom ou épouse. Il faudra aussi bien vérifier que ça fonctionne vis-à-vis des droits au passage en prod. --- scripts/cron/recherche.pl | 21 +++++++++++++++++++++ scripts/cron/recherche.sql | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100755 scripts/cron/recherche.pl create mode 100644 scripts/cron/recherche.sql diff --git a/scripts/cron/recherche.pl b/scripts/cron/recherche.pl new file mode 100755 index 0000000..a1a0c4f --- /dev/null +++ b/scripts/cron/recherche.pl @@ -0,0 +1,21 @@ +#! /usr/bin/perl -w + +my $mode = shift; +#mode 1 = mise à jour obligatoire +#mode autre = mise à jour si flag + +my @args = ("mysql x4dat ; + system(@args) + if (/1/); + close INFILE; + open(OUTFILE,'>/tmp/flag_recherche'); + print OUTFILE "0"; + close OUTFILE; +} diff --git a/scripts/cron/recherche.sql b/scripts/cron/recherche.sql new file mode 100644 index 0000000..3db8c2d --- /dev/null +++ b/scripts/cron/recherche.sql @@ -0,0 +1,6 @@ +USE x4dat; +DROP TABLE recherche; +CREATE TABLE recherche SELECT i.matricule AS matricule,LOWER(REPLACE(i.nom,'-',' ')) AS nom1, +LOWER(REPLACE(u.nom,'-',' ')) AS nom2, LOWER(REPLACE(u.epouse,'-',' ')) AS nom3, +LOWER(REPLACE(i.prenom,'-',' ')) AS prenom1, LOWER(REPLACE(u.prenom,'-',' ')) AS prenom2,i.promo AS +promo FROM identification AS i LEFT JOIN auth_user_md5 AS u ON (u.matricule=i.matricule); -- 2.1.4