diff --git a/src/siu/sq/lib/procesos/proceso_validar_instalacion.php b/src/siu/sq/lib/procesos/proceso_validar_instalacion.php
index 8f5d7dafb73055c75d669f5218e5c23a5bccf457..b304faf7d235cd38f20640cecab6841348a78457 100644
--- a/src/siu/sq/lib/procesos/proceso_validar_instalacion.php
+++ b/src/siu/sq/lib/procesos/proceso_validar_instalacion.php
@@ -1,6 +1,11 @@
entorno()->log()->info("INICIANDO PROCESO: Validar instalacion");
$this->ejecutar_especifico();
- $this->entorno()->log()->info("FINALIZANDO PROCESO: Validar instalacion");
}
function ejecutar_especifico()
{
$this->iniciar("INICIANDO VALIDACIONES DE LA INSTALACION");
-
+
+ $this->validaciones_logs();
+ $this->entorno()->log()->info("INICIANDO PROCESO: Validar instalacion");
$this->validaciones_php();
$this->validaciones_postgres();
$this->validaciones_version();
$this->validaciones_integracion();
-
+ $this->entorno()->log()->info("FINALIZANDO PROCESO: Validar instalacion");
+
if(!empty($this->error)){
$this->entorno()->log()->error(implode(PHP_EOL , $this->error));
if(class_exists('\toba_error')){
@@ -59,16 +65,59 @@ class proceso_validar_instalacion extends proceso
$this->imprimir_linea();
}
- function validaciones_php()
+ function validaciones_logs()
{
- // Validar permisos de escritura para los logs
+ $config = new configurador();
try {
- $this->entorno()->log()->info("Validando permisos para escribir en la carpeta de logs ok");
+ $handlers = $this->entorno()->log()->getHandlers();
+ foreach($handlers as $handler){
+ switch(get_class($handler)){
+ case "Monolog\Handler\StreamHandler" :
+ // Validar permisos de escritura para los logs
+ if(! is_writable(dirname($handler->getUrl()))) {
+ throw new \Exception("No tiene permisos para escribir en la carpeta de logs.");
+ }
+ break;
+ case "Monolog\Handler\GelfHandler" :
+ // Validar conexion con Graylog
+ $handle = fsockopen('udp://' . $config->sq_ini['graylog']['host'], $config->sq_ini['graylog']['port'], $errno, $errstr, 1);
+ if (!$handle) {
+ echo "$errno : $errstr
";
+ }
+ socket_set_timeout ($handle, 1);
+ $write = fwrite($handle,"x00");
+ if (!$write) {
+ echo "error writing to port: $index.
";
+ next;
+ }
+ $startTime = time();
+ $header = fread($handle, 1);
+ $endTime = time();
+ $timeDiff = $endTime - $startTime;
+
+ if ($timeDiff >= 1) {
+ fclose($handle);
+ } else {
+ fclose($handle);
+ throw new \Exception("No se pudo conectar con Graylog, revise la configuracion.");
+ }
+ break;
+ }
+ }
+ } catch (\RuntimeException $ex){
+ $this->error[] = $ex->getMessage();
+ throw new \Exception($ex->getMessage());
} catch (\Exception $ex){
- $this->error[] = "No tiene permisos para escribir en la carpeta de logs.";
+ $this->error[] = $ex->getMessage();
+ throw new \Exception($ex->getMessage());
}
}
+ function validaciones_php()
+ {
+
+ }
+
function validaciones_postgres()
{
// Validar encoding del motor postgres