Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
siu
instalador
Commits
3554980a
Commit
3554980a
authored
Sep 22, 2020
by
Richard Dalinger
Browse files
Agrega USE de clases faltantes
parent
f3424d07
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/SIU/Instalador/Paso.php
View file @
3554980a
...
...
@@ -3,13 +3,16 @@
namespace
SIU\Instalador
;
use
Dotenv\Dotenv
;
use
Psr\Log\LogLevel
;
use
Exception
;
use
Psr\Log\LoggerInterface
;
use
Psr\Log\LogLevel
;
use
SIU\AraiCli\AraiCli
;
use
SIU\CheckConstraints\Checker
;
use
SIU\TobaDb\DbPDO
;
use
Symfony\Component\Filesystem\Filesystem
;
use
Symfony\Component\Process\Exception\ProcessTimedOutException
;
use
Symfony\Component\Process\Process
;
use
SIU\AraiCli\AraiCli
;
use
ZipArchive
;
/**
* Description of Paso.
...
...
@@ -86,7 +89,7 @@ abstract class Paso implements PasoInterface
public
function
getChecker
()
{
if
(
!
$this
->
checker
instanceof
Checker
)
{
throw
new
\
Exception
(
"Debe setear una instancia de 'SIU\CheckContraint\Checker' primero."
);
throw
new
Exception
(
"Debe setear una instancia de 'SIU\CheckContraint\Checker' primero."
);
}
return
$this
->
checker
;
...
...
@@ -95,7 +98,7 @@ abstract class Paso implements PasoInterface
/**
* Retorna el objeto de manejo de configuración.
*
* @return
SIU\Instalador\
ConfiguracionInterface
* @return ConfiguracionInterface
*/
public
function
getConfiguracion
()
{
...
...
@@ -105,7 +108,7 @@ abstract class Paso implements PasoInterface
/**
* Retorna el objeto de manejo de configuración.
*
* @return
SIU\Instalador\
ConfiguracionInterface
* @return ConfiguracionInterface
*/
public
function
config
()
{
...
...
@@ -243,7 +246,7 @@ abstract class Paso implements PasoInterface
$this
->
log
(
$e
->
getCode
()
.
' - '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
$this
->
io
()
->
msgCaution
(
'Error en la ejecución del comando, se debe configurar la variable de entorno INSTALADOR_TIMEOUT con un valor superior'
);
exit
(
1
);
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
if
(
$raiseOnCapture
===
true
)
{
throw
$e
;
}
...
...
@@ -371,7 +374,7 @@ abstract class Paso implements PasoInterface
}
catch
(
\
Dotenv\Exception\ValidationException
$e
)
{
$this
->
msgErrorLog
(
"La variable '
$variable
' es requerida. "
,
$e
->
getMessage
());
exit
(
1
);
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$msg
=
null
;
if
(
strpos
(
$e
->
getMessage
(),
'Dotenv values containing spaces must be surrounded by quotes'
)
!==
false
)
{
$msg
=
" Los valores que contienen espacios deben estar entre comillas."
;
...
...
@@ -846,7 +849,7 @@ abstract class Paso implements PasoInterface
$this
->
io
()
->
msgCaution
(
$msg
);
exit
(
1
);
}
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
try
{
$db
=
$parametro_db
[
'dbname'
];
$parametro_db
[
'dbname'
]
=
'postgres'
;
...
...
@@ -859,7 +862,7 @@ abstract class Paso implements PasoInterface
$conn
->
ejecutar
(
'CREATE DATABASE "'
.
$db
.
'"'
);
$this
->
io
()
->
msgNote
(
"Se creó la base de datos de negocio '
$db
'
\n
"
);
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ Postgres ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
$this
->
io
()
->
msgCaution
(
"Error de conexion, no se pudo crear la base de datos '
$db
'"
);
exit
(
1
);
...
...
@@ -881,7 +884,7 @@ abstract class Paso implements PasoInterface
$fs
->
mkdir
(
$ruta
);
$result
=
true
;
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ FS ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
$result
=
false
;
}
...
...
@@ -909,7 +912,7 @@ abstract class Paso implements PasoInterface
$fs
->
copy
(
$origen
,
$destino
,
true
);
$result
=
true
;
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ FS ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
$result
=
false
;
}
...
...
@@ -931,7 +934,7 @@ abstract class Paso implements PasoInterface
try
{
$result
=
$fs
->
exists
(
$archivo
);
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ FS ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
$result
=
false
;
}
...
...
@@ -943,7 +946,7 @@ abstract class Paso implements PasoInterface
* Genera la clave para encriptar la sincronización de api REST con Araí
*
* @param string $syncKeyFile la ruta al archivo donde guardar la clave de sincronziación
* @throws
\
Exception si no se pudo generar la clave de encriptación
* @throws Exception si no se pudo generar la clave de encriptación
*/
public
function
generarSyncKeyArai
(
$syncKeyFile
)
{
...
...
@@ -956,12 +959,12 @@ abstract class Paso implements PasoInterface
* @param string $syncKeyFile la ruta al archivo desde donde leer la clave de sincronziación
*
* @return EncryptionKeyPair la clave de encriptación
* @throws
\
Exception si no se pudo cargar la clave de encriptación
* @throws Exception si no se pudo cargar la clave de encriptación
*/
public
function
cargarSyncKeyArai
(
$syncKeyFile
)
{
if
(
!
$this
->
existeArchivo
(
$syncKeyFile
))
{
throw
new
\
Exception
(
"No se puede leer el archivo '
$syncKeyFile
' para cargar la clave de encriptación de la api REST con Arai"
);
throw
new
Exception
(
"No se puede leer el archivo '
$syncKeyFile
' para cargar la clave de encriptación de la api REST con Arai"
);
}
return
AraiCli
::
getCryptoService
(
true
)
->
getPrivateFromSyncKey
(
$syncKeyFile
);
}
...
...
@@ -992,9 +995,9 @@ abstract class Paso implements PasoInterface
}
}
closedir
(
$directorio
);
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ ZIP ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
throw
new
\
Exception
(
"Error al comprimir sub-directorio o archivo "
.
$e
->
getMessage
());
throw
new
Exception
(
"Error al comprimir sub-directorio o archivo "
.
$e
->
getMessage
());
}
}
...
...
@@ -1010,14 +1013,14 @@ abstract class Paso implements PasoInterface
$nombre_dir
=
$ruta_info
[
'basename'
];
try
{
$z
=
new
\
ZipArchive
();
$z
=
new
ZipArchive
();
$z
->
open
(
$ruta_zip_salida
,
\
ZIPARCHIVE
::
CREATE
);
$z
->
addEmptyDir
(
$nombre_dir
);
$this
->
comprimirContenidosDir
(
$ruta_dir_entrada
,
$z
,
strlen
(
"
$ruta_padre
/"
));
$z
->
close
();
}
catch
(
\
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
log
(
'[ ZIP ] '
.
$e
->
getMessage
(),
LogLevel
::
ERROR
);
throw
new
\
Exception
(
"Error al comprimir directorio "
.
$e
->
getMessage
());
throw
new
Exception
(
"Error al comprimir directorio "
.
$e
->
getMessage
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment