issue #0001977 : Suppression de toutes les tables temporaires le samedi matin

This commit is contained in:
Michael RICOIS 2014-06-03 13:59:22 +00:00
parent 05281784e5
commit 53087a74f3

View File

@ -110,23 +110,37 @@ $tabQueries = array(
/**
* Liste des déclencheurs
*/
if ($opts->list) {
foreach($tabQueries as $key=>$querie)
if ( $opts->list ) {
foreach ( $tabQueries as $key => $query) {
echo "\t- $key".PHP_EOL;
}
exit;
}
/**
* Delete all temporary table
*/
$day = date('N');
if ( $opts->tout && $day == 6) {
foreach ( $tabQueries as $key => $query) {
try {
$db->query("DROP TABLE IF EXISTS $key;");
} catch(Zend_Db_Adapter_Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
}
}
/**
* Force declencheur
*/
if ($opts->declencheur) {
if ( $opts->declencheur ) {
if ( in_array($opts->declencheur, array_keys($tabQueries)) ) {
$tabQueries = array($opts->declencheur => $tabQueries[$opts->declencheur]);
} else {
exit;
}
}
$c = new Zend_Config($application->getOptions());