Skip to content

Commit 1396dca

Browse files
committed
Aplico configuraciones para debug solo en desarrollo
1 parent 810407e commit 1396dca

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

Lenguajes-Programacion/php.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
## @author Raúl Caro Pastorino
55
## @copyright Copyright © 2017 Raúl Caro Pastorino
66
## @license https://wwww.gnu.org/licenses/gpl.txt
7-
## @email tecnico@fryntiz.es
8-
## @web www.fryntiz.es
9-
## @github https://github.com/fryntiz
7+
## @email dev@fryntiz.es
8+
## @web https://fryntiz.es
109
## @gitlab https://gitlab.com/fryntiz
10+
## @github https://github.com/fryntiz
1111
## @twitter https://twitter.com/fryntiz
1212
##
1313
## Guía de estilos aplicada:
14-
## @style https://github.com/fryntiz/Bash_Style_Guide
14+
## @style https://gitlab.com/fryntiz/bash-style-guide
1515

1616
############################
1717
## INSTRUCCIONES ##
@@ -63,14 +63,17 @@ php_postconfiguracion() {
6363
echo -e "$VE Estableciendo zona horaria por defecto para PHP$CL"
6464
sudo sed -r -i "s/^;?\s*date\.timezone\s*=.*$/date\.timezone = 'UTC'/" $PHPINI
6565

66-
echo -e "$VE Activando Reportar todos los errores → 'error_reporting'$CL"
67-
sudo sed -r -i "s/^;?\s*error_reporting\s*=.*$/error_reporting = E_ALL/" $PHPINI
66+
## Configuración para desarrollo
67+
if [[ "$ENV" = 'dev' ]]; then
68+
echo -e "$VE Activando Reportar todos los errores → 'error_reporting'$CL"
69+
sudo sed -r -i "s/^;?\s*error_reporting\s*=.*$/error_reporting = E_ALL/" $PHPINI
6870

69-
echo -e "$VE Activando Mostrar errores → 'display_errors'$CL"
70-
sudo sed -r -i "s/^;?\s*display_errors\s*=.*$/display_errors = On/" $PHPINI
71+
echo -e "$VE Activando Mostrar errores → 'display_errors'$CL"
72+
sudo sed -r -i "s/^;?\s*display_errors\s*=.*$/display_errors = On/" $PHPINI
7173

72-
echo -e "$VE Activando Mostrar errores al iniciar → 'display_startup_errors'$CL"
73-
sudo sed -r -i "s/^;?\s*display_startup_errors\s*=.*$/display_startup_errors = On/" $PHPINI
74+
echo -e "$VE Activando Mostrar errores al iniciar → 'display_startup_errors'$CL"
75+
sudo sed -r -i "s/^;?\s*display_startup_errors\s*=.*$/display_startup_errors = On/" $PHPINI
76+
fi
7477

7578
echo -e "$VE Tiempo máximo de ejecución 3 minutos → 'max_execution_time'$CL"
7679
sudo sed -r -i "s/^;?\s*max_execution_time\s*=.*$/max_execution_time = 180/" $PHPINI
@@ -119,7 +122,9 @@ php_postconfiguracion() {
119122
cp "$WORKSCRIPT/tmp/php_manual.sqlite" "$HOME/.local/share/psysh/php_manual.sqlite"
120123
}
121124

122-
psysh
125+
if [[ "$ENV" = 'dev' ]]; then
126+
psysh
127+
fi
123128
}
124129

125130
## Preparar archivo con parámetros para xdebug
@@ -144,7 +149,9 @@ php_postconfiguracion() {
144149
#instalar_php "$V_PHP"
145150
configurar_php "$V_PHP"
146151
personalizar_php "$V_PHP"
147-
xdebug "$V_PHP"
152+
if [[ "$ENV" = 'dev' ]]; then
153+
xdebug "$V_PHP"
154+
fi
148155
done
149156

150157
## Si solo hay una versión de PHP la configura, en otro caso pregunta
@@ -177,7 +184,11 @@ php_postconfiguracion() {
177184

178185
## Activar módulos
179186
echo -e "$VE Activando módulos$CL"
180-
sudo phpenmod -s 'apache2' 'xdebug'
187+
sudo phpenmod 'fileinfo' 'ftp' 'curl' 'mongodb' 'pdo_pgsql' 'pgsql' 'sqlite3'
188+
189+
if [[ "$ENV" = 'dev' ]]; then
190+
sudo phpenmod 'xdebug'
191+
fi
181192

182193
echo -e "$VE Desactivando Módulos"
183194
## Xdebug para PHP CLI no tiene sentido y ralentiza
@@ -206,7 +217,7 @@ php_instalador() {
206217
php_postconfiguracion
207218

208219
if [[ "$1" = 'prod' ]]; then
220+
## TODO → Esta función está de más, controlar desde $ENV
209221
php_produccion
210222
fi
211-
212223
}

0 commit comments

Comments
 (0)