update:
- bin.php frontal command
This commit is contained in:
parent
fe77b35dcc
commit
ae43c2e6bb
|
@ -49,8 +49,9 @@ class Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$write_string = ob_get_clean();
|
$write_string = ob_get_clean();
|
||||||
file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . "errors".$date->format("Y-m-d").".log", $write_string);
|
file_put_contents(OUTPUT_PATH . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . "errors".$date->format("Y-m-d").".log", $write_string);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,37 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace MVC\Component;
|
namespace MVC\Command\Component;
|
||||||
|
|
||||||
|
use Tests\Behat\Gherkin\Loader\DirectoryLoaderTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Composant permettant de créér des fichiers de sortie de données
|
* Classe Output permettant de créér des fichiers de sortie de données
|
||||||
* @package Default
|
|
||||||
*/
|
*/
|
||||||
class Output
|
class Output
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Fonction statique permettant d'écrire un fichier de sortie
|
* Fonction statique permettant d'écrire le fichier CSV de sortie
|
||||||
* en lui donnant un nom particulier
|
* en lui donnant un nom particulier
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $data
|
* @param array $agents_tab
|
||||||
|
* @param \DateTime $date_debut
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function createOutPutFile(string $name, $data)
|
public static function createOutPutFile(string $name, array $agents_tab, \DateTime $date_debut)
|
||||||
{
|
{
|
||||||
|
$date_fin = new \DateTime('now');
|
||||||
$date_debut = new \DateTime('now');
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
echo "# ".$date_debut->format('d/m/Y H:i:s') . LINE_FEED;
|
echo "# ".$date_debut->format('d/m/Y H:i') . LINE_FEED;
|
||||||
echo $data . LINE_FEED;
|
foreach ($agents_tab as $agent) {
|
||||||
$date_fin = new \DateTime('now');
|
echo $agent . LINE_FEED;
|
||||||
echo "# FIN ".$date_fin->format('d/m/Y H:i:s') . LINE_FEED;
|
}
|
||||||
|
echo "# FIN ".$date_fin->format('d/m/Y H:i') . LINE_FEED;
|
||||||
|
|
||||||
$csv_file = ob_get_clean();
|
$csv_file = ob_get_clean();
|
||||||
|
|
||||||
//on insère la date du jour au début du nom de fichier
|
file_put_contents(OUTPUT_PATH . DIRECTORY_SEPARATOR . $date_debut->format('Y-m-d-') . $name, $csv_file);
|
||||||
$name = $date_debut->format("Y-m-d-").$name;
|
|
||||||
|
|
||||||
file_put_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $name, $csv_file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue