<s> """<STR_LIT>""" <EOL> from cement . core . controller import CementBaseController , expose <EOL> from cement . core import handler , hook <EOL> from ee . core . aptget import EEAptGet <EOL> from ee . core . shellexec import * <EOL> from ee . core . mysql import EEMysql <EOL> from ee . core . services import EEService <EOL> from ee . core . logging import Log <EOL> from ee . cli . plugins . site_functions import logwatch <EOL> from ee . core . variables import EEVariables <EOL> from ee . core . fileutils import EEFileUtils <EOL> from pynginxconfig import NginxConfig <EOL> import os <EOL> import configparser <EOL> import glob <EOL> import signal <EOL> import subprocess <EOL> def ee_debug_hook ( app ) : <EOL> pass <EOL> class EEDebugController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , choices = ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , choices = ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , choices = ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> action = '<STR_LIT:store>' , dest = '<STR_LIT>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , nargs = '<STR_LIT:?>' , default = None ) ) <EOL> ] <EOL> usage = "<STR_LIT>" <EOL> @ expose ( hide = True ) <EOL> def debug_nginx ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . nginx == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> try : <EOL> debug_address = ( self . app . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> . split ( ) ) <EOL> except Exception as e : <EOL> debug_address = [ '<STR_LIT>' ] <EOL> if debug_address == [ '<STR_LIT:127.0.0.1>' ] or debug_address == [ ] : <EOL> debug_address = [ '<STR_LIT>' ] <EOL> for ip_addr in debug_address : <EOL> if not ( "<STR_LIT>" + ip_addr in open ( '<STR_LIT>' <EOL> '<STR_LIT>' , encoding = '<STR_LIT:utf-8>' ) . read ( ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" + ip_addr ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ip = ip_addr ) ) <EOL> self . trigger_nginx = True <EOL> if not self . trigger_nginx : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ "<STR_LIT>" ] <EOL> elif ( self . app . pargs . nginx == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if "<STR_LIT>" in open ( '<STR_LIT>' , <EOL> encoding = '<STR_LIT:utf-8>' ) . read ( ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> elif ( self . app . pargs . nginx == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> config_path = ( "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> if os . path . isfile ( config_path ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( config_path ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( self . app . pargs . site_name ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( config_path ) ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ] <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> elif ( self . app . pargs . nginx == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> config_path = ( "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> if os . path . isfile ( config_path ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> . format ( config_path ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( config_path ) ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> @ expose ( hide = True ) <EOL> def debug_php ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . php == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if not ( EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> nc = NginxConfig ( ) <EOL> nc . loadf ( '<STR_LIT>' ) <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> nc . savef ( '<STR_LIT>' ) <EOL> EEFileUtils . searchreplace ( self , "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) + <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> with open ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as confifile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config . write ( confifile ) <EOL> self . trigger_php = True <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ] <EOL> elif ( self . app . pargs . php == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> nc = NginxConfig ( ) <EOL> nc . loadf ( '<STR_LIT>' ) <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> nc . savef ( '<STR_LIT>' ) <EOL> EEFileUtils . searchreplace ( self , "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) + <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . trigger_php = True <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_fpm ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . fpm == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config . remove_option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) <EOL> with open ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as configfile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config . write ( configfile ) <EOL> self . trigger_php = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ] <EOL> elif ( self . app . pargs . fpm == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config . remove_option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) <EOL> with open ( '<STR_LIT>' . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as configfile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( "<STR_LIT>" if EEVariables . ee_platform_codename == '<STR_LIT>' else "<STR_LIT>" ) ) <EOL> config . write ( configfile ) <EOL> self . trigger_php = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_php7 ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . php7 == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEVariables . ee_platform_codename != '<STR_LIT>' : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if not ( EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> nc = NginxConfig ( ) <EOL> nc . loadf ( '<STR_LIT>' ) <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> nc . savef ( '<STR_LIT>' ) <EOL> EEFileUtils . searchreplace ( self , "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> with open ( '<STR_LIT>' , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as confifile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> config . write ( confifile ) <EOL> self . trigger_php = True <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' ] <EOL> elif ( self . app . pargs . php7 == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> nc = NginxConfig ( ) <EOL> nc . loadf ( '<STR_LIT>' ) <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> nc . set ( [ ( '<STR_LIT>' , '<STR_LIT>' , ) , '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> nc . savef ( '<STR_LIT>' ) <EOL> EEFileUtils . searchreplace ( self , "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . trigger_php = True <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_fpm7 ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . fpm7 == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' ) <EOL> config . remove_option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> with open ( '<STR_LIT>' , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as configfile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> config . write ( configfile ) <EOL> self . trigger_php = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' ] <EOL> elif ( self . app . pargs . fpm7 == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> config = configparser . ConfigParser ( ) <EOL> config . read ( '<STR_LIT>' ) <EOL> config . remove_option ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> with open ( '<STR_LIT>' , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) as configfile : <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> config . write ( configfile ) <EOL> self . trigger_php = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_mysql ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . mysql == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> self . msg = self . msg + [ '<STR_LIT>' ] <EOL> elif ( self . app . pargs . mysql == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" ) <EOL> EEMysql . execute ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_wp ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . wp == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> wp_config = ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ) <EOL> webroot = "<STR_LIT>" . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) <EOL> if not os . path . isfile ( wp_config ) : <EOL> wp_config = ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ) <EOL> if os . path . isfile ( wp_config ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( wp_config ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> open ( "<STR_LIT>" . format ( webroot ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:a>' ) . close ( ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( webroot , <EOL> EEVariables . ee_php_user ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( wp_config ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( webroot ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( webroot , <EOL> EEVariables . ee_php_user ) ) <EOL> self . msg = self . msg + [ '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ] <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> elif ( self . app . pargs . wp == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> wp_config = ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ) <EOL> webroot = "<STR_LIT>" . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) <EOL> if not os . path . isfile ( wp_config ) : <EOL> wp_config = ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ) <EOL> if os . path . isfile ( wp_config ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( wp_config ) ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( wp_config ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( wp_config ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( wp_config ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( wp_config ) ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def debug_rewrite ( self ) : <EOL> """<STR_LIT>""" <EOL> if ( self . app . pargs . rewrite == '<STR_LIT>' and not self . app . pargs . site_name ) : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> if '<STR_LIT>' not in self . msg : <EOL> self . msg = self . msg + [ '<STR_LIT>' ] <EOL> elif ( self . app . pargs . rewrite == '<STR_LIT>' <EOL> and not self . app . pargs . site_name ) : <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> elif ( self . app . pargs . rewrite == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> config_path = ( "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> . format ( config_path ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( config_path ) ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> if ( '<STR_LIT>' . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) <EOL> not in self . msg ) : <EOL> self . msg = self . msg + [ '<STR_LIT>' <EOL> . format ( EEVariables . ee_webroot , <EOL> self . app . pargs . site_name ) ] <EOL> elif ( self . app . pargs . rewrite == '<STR_LIT>' and self . app . pargs . site_name ) : <EOL> config_path = ( "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> . format ( config_path ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( self . app . pargs . site_name ) ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> . format ( config_path ) ) <EOL> self . trigger_nginx = True <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( self . app . pargs . site_name ) ) <EOL> @ expose ( hide = True ) <EOL> def signal_handler ( self , signal , frame ) : <EOL> """<STR_LIT>""" <EOL> self . start = False <EOL> if self . app . pargs . nginx : <EOL> self . app . pargs . nginx = '<STR_LIT>' <EOL> self . debug_nginx ( ) <EOL> if self . app . pargs . php : <EOL> self . app . pargs . php = '<STR_LIT>' <EOL> self . debug_php ( ) <EOL> if self . app . pargs . php7 : <EOL> self . app . pargs . php7 = '<STR_LIT>' <EOL> self . debug_php7 ( ) <EOL> if self . app . pargs . fpm : <EOL> self . app . pargs . fpm = '<STR_LIT>' <EOL> self . debug_fpm ( ) <EOL> if self . app . pargs . fpm7 : <EOL> self . app . pargs . fpm7 = '<STR_LIT>' <EOL> self . debug_fpm7 ( ) <EOL> if self . app . pargs . mysql : <EOL> if EEVariables . ee_mysql_host is "<STR_LIT:localhost>" : <EOL> self . app . pargs . mysql = '<STR_LIT>' <EOL> self . debug_mysql ( ) <EOL> else : <EOL> Log . warn ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . app . pargs . wp : <EOL> self . app . pargs . wp = '<STR_LIT>' <EOL> self . debug_wp ( ) <EOL> if self . app . pargs . rewrite : <EOL> self . app . pargs . rewrite = '<STR_LIT>' <EOL> self . debug_rewrite ( ) <EOL> if self . trigger_nginx : <EOL> EEService . reload_service ( self , '<STR_LIT>' ) <EOL> if self . trigger_php : <EOL> if EEVariables . ee_platform_codename == '<STR_LIT>' : <EOL> if EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> EEService . reload_service ( self , '<STR_LIT>' ) <EOL> if EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> EEService . reload_service ( self , '<STR_LIT>' ) <EOL> else : <EOL> EEService . reload_service ( self , '<STR_LIT>' ) <EOL> self . app . close ( <NUM_LIT:0> ) <EOL> @ expose ( hide = True ) <EOL> def default ( self ) : <EOL> """<STR_LIT>""" <EOL> self . interactive = False <EOL> self . msg = [ ] <EOL> self . trigger_nginx = False <EOL> self . trigger_php = False <EOL> if ( ( not self . app . pargs . nginx ) and ( not self . app . pargs . php ) and ( not self . app . pargs . php7 ) <EOL> and ( not self . app . pargs . fpm ) and ( not self . app . pargs . fpm7 ) and ( not self . app . pargs . mysql ) <EOL> and ( not self . app . pargs . wp ) and ( not self . app . pargs . rewrite ) <EOL> and ( not self . app . pargs . all ) <EOL> and ( not self . app . pargs . site_name ) <EOL> and ( not self . app . pargs . import_slow_log ) <EOL> and ( not self . app . pargs . interval ) ) : <EOL> if self . app . pargs . stop or self . app . pargs . start : <EOL> print ( "<STR_LIT>" ) <EOL> self . app . args . print_help ( ) <EOL> else : <EOL> self . app . args . print_help ( ) <EOL> if self . app . pargs . import_slow_log : <EOL> self . import_slow_log ( ) <EOL> if self . app . pargs . interval : <EOL> try : <EOL> cron_time = int ( self . app . pargs . interval ) <EOL> except Exception as e : <EOL> cron_time = <NUM_LIT:5> <EOL> try : <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) : <EOL> if not cron_time == <NUM_LIT:0> : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( cron_time ) ) <EOL> else : <EOL> if not cron_time == <NUM_LIT:0> : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( cron_time ) ) : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( cron_time ) ) : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> except CommandExecutionError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> if self . app . pargs . all == '<STR_LIT>' : <EOL> if self . app . pargs . site_name : <EOL> self . app . pargs . wp = '<STR_LIT>' <EOL> self . app . pargs . nginx = '<STR_LIT>' <EOL> self . app . pargs . php = '<STR_LIT>' <EOL> self . app . pargs . fpm = '<STR_LIT>' <EOL> if EEVariables . ee_platform_codename == '<STR_LIT>' and EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> self . app . pargs . php7 = '<STR_LIT>' <EOL> self . app . pargs . fpm7 = '<STR_LIT>' <EOL> self . app . pargs . mysql = '<STR_LIT>' <EOL> self . app . pargs . rewrite = '<STR_LIT>' <EOL> if self . app . pargs . all == '<STR_LIT>' : <EOL> if self . app . pargs . site_name : <EOL> self . app . pargs . wp = '<STR_LIT>' <EOL> self . app . pargs . nginx = '<STR_LIT>' <EOL> self . app . pargs . php = '<STR_LIT>' <EOL> self . app . pargs . fpm = '<STR_LIT>' <EOL> if EEVariables . ee_platform_codename == '<STR_LIT>' and EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> self . app . pargs . php7 = '<STR_LIT>' <EOL> self . app . pargs . fpm7 = '<STR_LIT>' <EOL> self . app . pargs . mysql = '<STR_LIT>' <EOL> self . app . pargs . rewrite = '<STR_LIT>' <EOL> if ( ( not self . app . pargs . nginx ) and ( not self . app . pargs . php ) and ( not self . app . pargs . php7 ) <EOL> and ( not self . app . pargs . fpm ) and ( not self . app . pargs . fpm7 ) and ( not self . app . pargs . mysql ) <EOL> and ( not self . app . pargs . wp ) and ( not self . app . pargs . rewrite ) <EOL> and self . app . pargs . site_name ) : <EOL> self . app . args . print_help ( ) <EOL> if self . app . pargs . nginx : <EOL> self . debug_nginx ( ) <EOL> if self . app . pargs . php : <EOL> self . debug_php ( ) <EOL> if self . app . pargs . fpm : <EOL> self . debug_fpm ( ) <EOL> if self . app . pargs . php7 : <EOL> self . debug_php7 ( ) <EOL> if self . app . pargs . fpm7 : <EOL> self . debug_fpm7 ( ) <EOL> if self . app . pargs . mysql : <EOL> if EEVariables . ee_mysql_host is "<STR_LIT:localhost>" : <EOL> self . debug_mysql ( ) <EOL> else : <EOL> Log . warn ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . app . pargs . wp : <EOL> self . debug_wp ( ) <EOL> if self . app . pargs . rewrite : <EOL> self . debug_rewrite ( ) <EOL> if self . app . pargs . interactive : <EOL> self . interactive = True <EOL> if self . trigger_nginx : <EOL> EEService . reload_service ( self , '<STR_LIT>' ) <EOL> if self . trigger_php : <EOL> if EEVariables . ee_platform_codename == '<STR_LIT>' : <EOL> if EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> EEService . restart_service ( self , '<STR_LIT>' ) <EOL> if EEAptGet . is_installed ( self , '<STR_LIT>' ) : <EOL> EEService . restart_service ( self , '<STR_LIT>' ) <EOL> else : <EOL> EEService . restart_service ( self , '<STR_LIT>' ) <EOL> if len ( self . msg ) > <NUM_LIT:0> : <EOL> if not self . app . pargs . interactive : <EOL> disp_msg = '<STR_LIT:U+0020>' . join ( self . msg ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> + Log . ENDC + "<STR_LIT>" . format ( disp_msg ) ) <EOL> else : <EOL> signal . signal ( signal . SIGINT , self . signal_handler ) <EOL> watch_list = [ ] <EOL> for w_list in self . msg : <EOL> watch_list = watch_list + glob . glob ( w_list ) <EOL> logwatch ( self , watch_list ) <EOL> @ expose ( hide = True ) <EOL> def import_slow_log ( self ) : <EOL> """<STR_LIT>""" <EOL> if os . path . isdir ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot ) ) : <EOL> if os . path . isfile ( "<STR_LIT>" ) : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> host = os . popen ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot ) <EOL> + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) . read ( ) <EOL> user = os . popen ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot ) <EOL> + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) . read ( ) <EOL> password = os . popen ( "<STR_LIT>" <EOL> . format ( EEVariables . ee_webroot ) <EOL> + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) . read ( ) <EOL> try : <EOL> EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( user , password , host ) ) <EOL> except CommandExecutionError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" + <EOL> Log . ENDC + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> + Log . BOLD + "<STR_LIT>" <EOL> + Log . ENDC ) <EOL> def load ( app ) : <EOL> handler . register ( EEDebugController ) <EOL> hook . register ( '<STR_LIT>' , ee_debug_hook ) </s>
