448 |
ddelon |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
474 |
alexandre_ |
22 |
// CVS : $Id: commande_serveur.class.php,v 1.2 2005-09-27 16:37:40 alexandre_tb Exp $
|
448 |
ddelon |
23 |
/**
|
|
|
24 |
* Application projet
|
|
|
25 |
*
|
|
|
26 |
* La classe commande_serveur
|
|
|
27 |
*
|
|
|
28 |
*@package projet
|
|
|
29 |
//Auteur original :
|
|
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
31 |
//Autres auteurs :
|
|
|
32 |
*@author Aucun
|
|
|
33 |
*@copyright Tela-Botanica 2000-2004
|
474 |
alexandre_ |
34 |
*@version $Revision: 1.2 $
|
448 |
ddelon |
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | ENTETE du PROGRAMME |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* class commande_serveur
|
|
|
46 |
* Cette classe permet d'accéder au fichier ezmlm.sh afin de lui ajouter des
|
|
|
47 |
* commandes qui seront effectués périodiquement par le serveur.
|
|
|
48 |
*/
|
|
|
49 |
class commande_serveur
|
|
|
50 |
{
|
|
|
51 |
|
|
|
52 |
/*** Attributes: ***/
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* Pointeur vers le fichier des commandes
|
|
|
56 |
* @access private
|
|
|
57 |
*/
|
|
|
58 |
var $_fichier;
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
*
|
|
|
62 |
*
|
|
|
63 |
* @return void
|
|
|
64 |
* @access public
|
|
|
65 |
*/
|
|
|
66 |
function commande_serveur($fichier)
|
|
|
67 |
{
|
|
|
68 |
$this->_fichier = fopen ($fichier,'a+') ;
|
|
|
69 |
if (!$this->_fichier) {
|
|
|
70 |
return 'Impossible d\'ouvrir le fichier de commande' ;
|
|
|
71 |
}
|
|
|
72 |
} // end of member function commande_serveur
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
*
|
|
|
76 |
*
|
|
|
77 |
* @param string commande La commande, une chaine à ajouter à la fin du fichier ezmlm.sh
|
|
|
78 |
* @return bool
|
|
|
79 |
* @access public
|
|
|
80 |
*/
|
|
|
81 |
function ajouterCommande( $commande )
|
|
|
82 |
{
|
|
|
83 |
fwrite ($this->_fichier, "\n".$commande) ;
|
|
|
84 |
} // end of member function ajouterCommande
|
|
|
85 |
|
|
|
86 |
/**
|
|
|
87 |
* Destructeur
|
|
|
88 |
*
|
|
|
89 |
* @return void
|
|
|
90 |
* @access public
|
|
|
91 |
*/
|
|
|
92 |
function _commande_serveur($fichier)
|
|
|
93 |
{
|
|
|
94 |
fclose ($this->_fichier) ;
|
|
|
95 |
} // end of member function commande_serveur
|
|
|
96 |
|
|
|
97 |
/**
|
|
|
98 |
*
|
|
|
99 |
*
|
|
|
100 |
* @return
|
|
|
101 |
*/
|
|
|
102 |
|
|
|
103 |
function enleverToutesCommandes () {
|
|
|
104 |
ftruncate ($this->_fichier, 12) ;
|
|
|
105 |
}
|
|
|
106 |
} // end of commande_serveur
|
|
|
107 |
?>
|