simplifications
authorx2000habouzit <x2000habouzit>
Sat, 2 Oct 2004 15:34:53 +0000 (15:34 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 2 Oct 2004 15:34:53 +0000 (15:34 +0000)
scripts/cron/checkdb.php
scripts/cron/clean.php
scripts/cron/connect.db.inc.php [new file with mode: 0644]
scripts/cron/cron_validations.php
scripts/cron/recherche.php

index f2d87d8..9794a56 100755 (executable)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: checkdb.php,v 1.2 2004-10-02 15:28:11 x2000habouzit Exp $
+        $Id: checkdb.php,v 1.3 2004-10-02 15:34:53 x2000habouzit Exp $
  ***************************************************************************/
 /*
  * verifie qu'il n'y a pas d'incoherences dans les tables de jointures
  * 
- * $Id: checkdb.php,v 1.2 2004-10-02 15:28:11 x2000habouzit Exp $
+ * $Id: checkdb.php,v 1.3 2004-10-02 15:34:53 x2000habouzit Exp $
 */ 
 
-ini_set("include_path","/usr/share/php");
-
-require("../../include/xorg.misc.inc.php");
-require("../../include/config.xorg.inc.php");
-mysql_connect($globals->dbhost,$globals->dbuser,$globals->dbpwd);
-mysql_select_db($globals->dbdb);
-
+require('./connect.db.inc.php');
 require("Console/Getopt.php");
 
 function check($sql, $commentaire='') {
index 54fe871..1cd6bf3 100755 (executable)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: clean.php,v 1.2 2004-10-02 15:28:11 x2000habouzit Exp $
+        $Id: clean.php,v 1.3 2004-10-02 15:34:53 x2000habouzit Exp $
  ***************************************************************************/
-require("../../include/xorg.misc.inc.php");
-require("../../include/config.xorg.inc.php");
-mysql_connect($globals->dbhost,$globals->dbuser,$globals->dbpwd);
-mysql_select_db($globals->dbdb);
+
+require('./connect.db.inc.php');
 
 function query ($sql) {
     mysql_query($sql);
diff --git a/scripts/cron/connect.db.inc.php b/scripts/cron/connect.db.inc.php
new file mode 100644 (file)
index 0000000..ece77f6
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************
+        $Id: connect.db.inc.php,v 1.1 2004-10-02 15:34:53 x2000habouzit Exp $
+ ***************************************************************************/
+
+ini_set("include_path","/usr/share/php:../../include");
+require("../../include/xorg.misc.inc.php");
+require("../../include/config.xorg.inc.php");
+mysql_connect($globals->dbhost,$globals->dbuser,$globals->dbpwd);
+mysql_select_db($globals->dbdb);
+?>
index 30f4c67..bc8f087 100755 (executable)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: cron_validations.php,v 1.1 2004-10-02 15:28:11 x2000habouzit Exp $
+        $Id: cron_validations.php,v 1.2 2004-10-02 15:34:53 x2000habouzit Exp $
  ***************************************************************************/
 /* vim: set sw=4 ts=4 sts=4 tw=100:
  * vérifie qu'il n'y a pas de validations en cours, et maile si c'est le cas
  * 
- * $Id: cron_validations.php,v 1.1 2004-10-02 15:28:11 x2000habouzit Exp $
+ * $Id: cron_validations.php,v 1.2 2004-10-02 15:34:53 x2000habouzit Exp $
 */ 
 
 $M_PERIOD = "INTERVAL 3 HOUR"; // période d'envoi des mails de 3h
 $R_PERIOD = "INTERVAL 6 HOUR"; // période de réponse moyenne de 6h
 
-ini_set("include_path","/usr/share/php");
-require("../../include/xorg.misc.inc.php");
-require("../../include/config.xorg.inc.php");
 require("../../../diogenes/lib/diogenes.mailer.inc.php");
-
-mysql_connect($globals->dbhost,$globals->dbuser,$globals->dbpwd);
-mysql_select_db($globals->dbdb);
+require('./connect.db.inc.php');
 
 $sql = mysql_query("SELECT count(stamp), sum(stamp < NOW() - $M_PERIOD), sum(stamp < NOW() - $R_PERIOD) FROM x4dat.requests");
 list($nb,$nbold,$nbveryold) = mysql_fetch_row($sql);
index 38a551b..d45536a 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: recherche.php,v 1.3 2004-10-02 15:02:06 x2000habouzit Exp $
+        $Id: recherche.php,v 1.4 2004-10-02 15:34:53 x2000habouzit Exp $
  ***************************************************************************/
 
-require("../../include/xorg.misc.inc.php");
-require("../../include/config.xorg.inc.php");
-
-mysql_connect($globals->dbhost,$globals->dbuser,$globals->dbpwd);
-mysql_select_db($globals->dbdb);
+require('./connect.db.inc.php');
 
 $result = mysql_query("SELECT matricule,nom1,nom2,nom3,prenom1,prenom2,promo FROM recherche");