Amélioration sur l'indicateur de lecture
This commit is contained in:
parent
138d11cbb1
commit
c698d4c038
26
fileRead.php
26
fileRead.php
@ -161,14 +161,22 @@ if ( isset($opts->file) )
|
||||
{
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
try {
|
||||
$fluxM = new Application_Model_Sdv1FluxFileOut();
|
||||
$fluxM->update(array('depotDateRead' => date('YmdHis')), "fileOut='".$filenameIn."'");
|
||||
echo date('Y-m-d H:i:s')." - Enregistrement client:$client fichier:$filenameIn\n";
|
||||
}
|
||||
catch (Zend_Db_Exception $e)
|
||||
{
|
||||
echo date('Y-m-d H:i:s')." - ERREUR Enregistrement client:$client fichier:$filenameIn\n";
|
||||
}
|
||||
$fluxM = new Application_Model_Sdv1FluxFileOut();
|
||||
|
||||
// --- Vérifier si l'indicateur de lecture n'a pas déjà été ecrit
|
||||
$readSql = $fluxM->select()->where("fileOut='".$filenameIn."'");
|
||||
$readResult = $fluxM->fetchRow($readSql);
|
||||
if ($readResult !== null) {
|
||||
if ($readResult->depotDateRead == 0) {
|
||||
// --- Ecrire l'indicateur de lecture
|
||||
try {
|
||||
$fluxM->update(array('depotDateRead' => date('YmdHis')), "fileOut='".$filenameIn."'");
|
||||
echo date('Y-m-d H:i:s')." - Enregistrement client:$client fichier:$filenameIn\n";
|
||||
}
|
||||
catch (Zend_Db_Exception $e){
|
||||
echo date('Y-m-d H:i:s')." - ERREUR Enregistrement client:$client fichier:$filenameIn\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -53,6 +53,7 @@ switch($opts->event)
|
||||
}
|
||||
break;
|
||||
case 'IN_ACCESS':
|
||||
case 'IN_CLOSE_NOWRITE':
|
||||
passthru(__DIR__ . '/fileRead.php --file '.$opts->file.' >> /home/log/read.log 2>&1');
|
||||
break;
|
||||
case 'IN_DELETE':
|
||||
|
Loading…
Reference in New Issue
Block a user