little cleanup
This commit is contained in:
		
				
					committed by
					
						
						Diego Antunes
					
				
			
			
				
	
			
			
			
						parent
						
							4ce1d7f64a
						
					
				
				
					commit
					bce05e4b59
				
			@@ -4,7 +4,7 @@
 | 
			
		||||
#--------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# To edit the 'php-fpm' base Image, visit its repository on Github
 | 
			
		||||
#    https://github.com/LaraDock/php-fpm
 | 
			
		||||
#    https://github.com/Laradock/php-fpm
 | 
			
		||||
#
 | 
			
		||||
# To change its version, see the available Tags on the Docker Hub:
 | 
			
		||||
#    https://hub.docker.com/r/laradock/php-fpm/tags/
 | 
			
		||||
@@ -22,7 +22,7 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
 | 
			
		||||
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
 | 
			
		||||
# are installed on the base image 'laradock/php-fpm' image. If you want
 | 
			
		||||
# to add more Software's or remove existing one, you need to edit the
 | 
			
		||||
# base image (https://github.com/LaraDock/php-fpm).
 | 
			
		||||
# base image (https://github.com/Laradock/php-fpm).
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
#--------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# To edit the 'php-fpm' base Image, visit its repository on Github
 | 
			
		||||
#    https://github.com/LaraDock/php-fpm
 | 
			
		||||
#    https://github.com/Laradock/php-fpm
 | 
			
		||||
#
 | 
			
		||||
# To change its version, see the available Tags on the Docker Hub:
 | 
			
		||||
#    https://hub.docker.com/r/laradock/php-fpm/tags/
 | 
			
		||||
@@ -22,7 +22,7 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
 | 
			
		||||
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
 | 
			
		||||
# are installed on the base image 'laradock/php-fpm' image. If you want
 | 
			
		||||
# to add more Software's or remove existing one, you need to edit the
 | 
			
		||||
# base image (https://github.com/LaraDock/php-fpm).
 | 
			
		||||
# base image (https://github.com/Laradock/php-fpm).
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
#--------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# To edit the 'php-fpm' base Image, visit its repository on Github
 | 
			
		||||
#    https://github.com/LaraDock/php-fpm
 | 
			
		||||
#    https://github.com/Laradock/php-fpm
 | 
			
		||||
#
 | 
			
		||||
# To change its version, see the available Tags on the Docker Hub:
 | 
			
		||||
#    https://hub.docker.com/r/laradock/php-fpm/tags/
 | 
			
		||||
@@ -22,7 +22,7 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
 | 
			
		||||
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
 | 
			
		||||
# are installed on the base image 'laradock/php-fpm' image. If you want
 | 
			
		||||
# to add more Software's or remove existing one, you need to edit the
 | 
			
		||||
# base image (https://github.com/LaraDock/php-fpm).
 | 
			
		||||
# base image (https://github.com/Laradock/php-fpm).
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										101
									
								
								php-fpm/xdebug
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										101
									
								
								php-fpm/xdebug
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,101 @@
 | 
			
		||||
#! /bin/bash
 | 
			
		||||
 | 
			
		||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Grab full name of php-fpm container
 | 
			
		||||
PHP_FPM_CONTAINER=$(docker ps | grep php-fpm | awk '{print $1}')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Grab OS type
 | 
			
		||||
if [[ "$(uname)" == "Darwin" ]]; then
 | 
			
		||||
    OS_TYPE="OSX"
 | 
			
		||||
else
 | 
			
		||||
    OS_TYPE=$(expr substr $(uname -s) 1 5)
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
xdebug_status ()
 | 
			
		||||
{
 | 
			
		||||
    echo 'xDebug status'
 | 
			
		||||
 | 
			
		||||
    # If running on Windows, need to prepend with winpty :(
 | 
			
		||||
    if [[ $OS_TYPE == "MINGW" ]]; then
 | 
			
		||||
        winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
 | 
			
		||||
    else
 | 
			
		||||
        docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
xdebug_start ()
 | 
			
		||||
{
 | 
			
		||||
    echo 'Start xDebug'
 | 
			
		||||
 | 
			
		||||
    # And uncomment line with xdebug extension, thus enabling it
 | 
			
		||||
    ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' \
 | 
			
		||||
                    /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # If running on Windows, need to prepend with winpty :(
 | 
			
		||||
    if [[ $OS_TYPE == "MINGW" ]]; then
 | 
			
		||||
        winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
 | 
			
		||||
        docker restart $PHP_FPM_CONTAINER
 | 
			
		||||
        winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
 | 
			
		||||
    else
 | 
			
		||||
        docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
 | 
			
		||||
        docker restart $PHP_FPM_CONTAINER
 | 
			
		||||
        docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
xdebug_stop ()
 | 
			
		||||
{
 | 
			
		||||
    echo 'Stop xDebug'
 | 
			
		||||
 | 
			
		||||
    # Comment out xdebug extension line
 | 
			
		||||
    OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # If running on Windows, need to prepend with winpty :(
 | 
			
		||||
    if [[ $OS_TYPE == "MINGW" ]]; then
 | 
			
		||||
        # This is the equivalent of:
 | 
			
		||||
        # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
 | 
			
		||||
        # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593
 | 
			
		||||
        winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
 | 
			
		||||
        docker restart $PHP_FPM_CONTAINER
 | 
			
		||||
        #docker-compose restart php-fpm
 | 
			
		||||
        winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
 | 
			
		||||
    else
 | 
			
		||||
        docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
 | 
			
		||||
        # docker-compose restart php-fpm
 | 
			
		||||
        docker restart $PHP_FPM_CONTAINER
 | 
			
		||||
        docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
case $@ in
 | 
			
		||||
    stop|STOP)
 | 
			
		||||
        xdebug_stop
 | 
			
		||||
        ;;
 | 
			
		||||
    start|START)
 | 
			
		||||
        xdebug_start
 | 
			
		||||
        ;;
 | 
			
		||||
    status|STATUS)
 | 
			
		||||
        xdebug_status
 | 
			
		||||
        ;;
 | 
			
		||||
    *)
 | 
			
		||||
        echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
 | 
			
		||||
        echo "xDebug must have already been installed."
 | 
			
		||||
        echo "Usage:"
 | 
			
		||||
        echo "  .php-fpm/xdebug stop|start|status"
 | 
			
		||||
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
exit 1
 | 
			
		||||
		Reference in New Issue
	
	Block a user