<s> from cement . core . controller import CementBaseController , expose <EOL> from cement . core import handler , hook <EOL> from ee . core . cron import EECron <EOL> from ee . core . sslutils import SSL <EOL> from ee . core . variables import EEVariables <EOL> from ee . core . domainvalidate import ValidateDomain <EOL> from ee . core . fileutils import EEFileUtils <EOL> from ee . cli . plugins . site_functions import * <EOL> from ee . core . services import EEService <EOL> from ee . cli . plugins . sitedb import * <EOL> from ee . core . git import EEGit <EOL> from subprocess import Popen <EOL> from ee . core . nginxhashbucket import hashbucket <EOL> import sys <EOL> import os <EOL> import glob <EOL> import subprocess <EOL> def ee_site_hook ( app ) : <EOL> from ee . core . database import init_db <EOL> import ee . cli . plugins . models <EOL> init_db ( app ) <EOL> class EESiteController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = ( '<STR_LIT>' ) <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ] <EOL> usage = "<STR_LIT>" <EOL> @ expose ( hide = True ) <EOL> def default ( self ) : <EOL> self . app . args . print_help ( ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def enable ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> Log . info ( self , "<STR_LIT>" . format ( ee_domain ) , end = '<STR_LIT>' ) <EOL> EEFileUtils . create_symlink ( self , <EOL> [ '<STR_LIT>' <EOL> . format ( ee_domain ) , <EOL> '<STR_LIT>' <EOL> . format ( ee_domain ) ] ) <EOL> EEGit . add ( self , [ "<STR_LIT>" ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> updateSiteInfo ( self , ee_domain , enabled = True ) <EOL> Log . info ( self , "<STR_LIT:[>" + Log . ENDC + "<STR_LIT:OK>" + Log . OKBLUE + "<STR_LIT:]>" ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def disable ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) , end = '<STR_LIT>' ) <EOL> if not os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> Log . debug ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> Log . info ( self , "<STR_LIT:[>" + Log . FAIL + "<STR_LIT>" + Log . OKBLUE + "<STR_LIT:]>" ) <EOL> else : <EOL> EEFileUtils . remove_symlink ( self , <EOL> '<STR_LIT>' <EOL> . format ( ee_domain ) ) <EOL> EEGit . add ( self , [ "<STR_LIT>" ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> updateSiteInfo ( self , ee_domain , enabled = False ) <EOL> Log . info ( self , "<STR_LIT:[>" + Log . ENDC + "<STR_LIT:OK>" + Log . OKBLUE + "<STR_LIT:]>" ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def info ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> ee_db_name = '<STR_LIT>' <EOL> ee_db_user = '<STR_LIT>' <EOL> ee_db_pass = '<STR_LIT>' <EOL> hhvm = '<STR_LIT>' <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> siteinfo = getSiteInfo ( self , ee_domain ) <EOL> sitetype = siteinfo . site_type <EOL> cachetype = siteinfo . cache_type <EOL> ee_site_webroot = siteinfo . site_path <EOL> access_log = ( ee_site_webroot + '<STR_LIT>' ) <EOL> error_log = ( ee_site_webroot + '<STR_LIT>' ) <EOL> ee_db_name = siteinfo . db_name <EOL> ee_db_user = siteinfo . db_user <EOL> ee_db_pass = siteinfo . db_password <EOL> ee_db_host = siteinfo . db_host <EOL> if sitetype != "<STR_LIT:html>" : <EOL> hhvm = ( "<STR_LIT>" if siteinfo . is_hhvm else "<STR_LIT>" ) <EOL> if sitetype == "<STR_LIT>" : <EOL> access_log = "<STR_LIT>" . format ( ee_domain ) <EOL> error_log = "<STR_LIT>" . format ( ee_domain ) <EOL> ee_site_webroot = '<STR_LIT>' <EOL> php_version = siteinfo . php_version <EOL> pagespeed = ( "<STR_LIT>" if siteinfo . is_pagespeed else "<STR_LIT>" ) <EOL> ssl = ( "<STR_LIT>" if siteinfo . is_ssl else "<STR_LIT>" ) <EOL> if ( ssl == "<STR_LIT>" ) : <EOL> sslprovider = "<STR_LIT>" <EOL> sslexpiry = str ( SSL . getExpirationDate ( self , ee_domain ) ) <EOL> else : <EOL> sslprovider = '<STR_LIT>' <EOL> sslexpiry = '<STR_LIT>' <EOL> data = dict ( domain = ee_domain , webroot = ee_site_webroot , <EOL> accesslog = access_log , errorlog = error_log , <EOL> dbname = ee_db_name , dbuser = ee_db_user , php_version = php_version , <EOL> dbpass = ee_db_pass , hhvm = hhvm , pagespeed = pagespeed , <EOL> ssl = ssl , sslprovider = sslprovider , sslexpiry = sslexpiry , <EOL> type = sitetype + "<STR_LIT:U+0020>" + cachetype + "<STR_LIT>" <EOL> . format ( "<STR_LIT>" if siteinfo . is_enabled else <EOL> "<STR_LIT>" ) ) <EOL> self . app . render ( ( data ) , '<STR_LIT>' ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def log ( self ) : <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> ee_site_webroot = getSiteInfo ( self , ee_domain ) . site_path <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> logfiles = glob . glob ( ee_site_webroot + '<STR_LIT>' ) <EOL> if logfiles : <EOL> logwatch ( self , logfiles ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def show ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> f = open ( '<STR_LIT>' . format ( ee_domain ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:r>' ) <EOL> text = f . read ( ) <EOL> Log . info ( self , Log . ENDC + text ) <EOL> f . close ( ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def cd ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> ee_site_webroot = getSiteInfo ( self , ee_domain ) . site_path <EOL> EEFileUtils . chdir ( self , ee_site_webroot ) <EOL> try : <EOL> subprocess . call ( [ '<STR_LIT>' ] ) <EOL> except OSError as e : <EOL> Log . debug ( self , "<STR_LIT>" . format ( e . errno , e . strerror ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> class EESiteEditController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = ( '<STR_LIT>' ) <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> action = '<STR_LIT:store_true>' ) ) , <EOL> ] <EOL> @ expose ( hide = True ) <EOL> def default ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> ee_site_webroot = EEVariables . ee_webroot + ee_domain <EOL> if not self . app . pargs . pagespeed : <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> try : <EOL> EEShellExec . invoke_editor ( self , '<STR_LIT>' <EOL> '<STR_LIT>' . format ( ee_domain ) ) <EOL> except CommandExecutionError as e : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if ( EEGit . checkfilestatus ( self , "<STR_LIT>" , <EOL> '<STR_LIT>' . format ( ee_domain ) ) ) : <EOL> EEGit . add ( self , [ "<STR_LIT>" ] , msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> elif self . app . pargs . pagespeed : <EOL> if os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_site_webroot ) ) : <EOL> try : <EOL> EEShellExec . invoke_editor ( self , '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> . format ( ee_site_webroot ) ) <EOL> except CommandExecutionError as e : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if ( EEGit . checkfilestatus ( self , "<STR_LIT>" <EOL> . format ( ee_site_webroot ) , <EOL> '<STR_LIT>' . format ( ee_site_webroot ) ) ) : <EOL> EEGit . add ( self , [ "<STR_LIT>" . format ( ee_site_webroot ) ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> class EESiteCreateController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> nargs = '<STR_LIT:?>' ) ) , <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>" , 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> 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> 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> 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>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> dest = '<STR_LIT>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , nargs = '<STR_LIT:+>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> action = '<STR_LIT:store_true>' ) ) , <EOL> ] <EOL> @ expose ( hide = True ) <EOL> def default ( self ) : <EOL> data = dict ( ) <EOL> host , port = None , None <EOL> try : <EOL> stype , cache = detSitePar ( vars ( self . app . pargs ) ) <EOL> except RuntimeError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if stype is None and self . app . pargs . proxy : <EOL> stype , cache = '<STR_LIT>' , '<STR_LIT>' <EOL> proxyinfo = self . app . pargs . proxy [ <NUM_LIT:0> ] . strip ( ) <EOL> if not proxyinfo : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> proxyinfo = proxyinfo . split ( '<STR_LIT::>' ) <EOL> host = proxyinfo [ <NUM_LIT:0> ] . strip ( ) <EOL> port = '<STR_LIT>' if len ( proxyinfo ) < <NUM_LIT:2> else proxyinfo [ <NUM_LIT:1> ] . strip ( ) <EOL> elif stype is None and not self . app . pargs . proxy : <EOL> stype , cache = '<STR_LIT:html>' , '<STR_LIT>' <EOL> elif stype and self . app . pargs . proxy : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if ( self . app . pargs . proxy and ( self . app . pargs . pagespeed <EOL> or self . app . pargs . hhvm ) ) : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> if not ee_domain . strip ( ) : <EOL> Log . error ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ee_site_webroot = EEVariables . ee_webroot + ee_domain <EOL> if check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> elif os . path . isfile ( '<STR_LIT>' <EOL> . format ( ee_domain ) ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> if stype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = ee_domain <EOL> data [ '<STR_LIT>' ] = ee_www_domain <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT:host>' ] = host <EOL> data [ '<STR_LIT:port>' ] = port <EOL> ee_site_webroot = "<STR_LIT>" <EOL> if self . app . pargs . php7 : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> static = False , basic = False , php7 = True , wp = False , w3tc = False , <EOL> wpfc = False , wpsc = False , multisite = False , <EOL> wpsubdir = False , webroot = ee_site_webroot ) <EOL> data [ '<STR_LIT>' ] = True <EOL> if stype in [ '<STR_LIT:html>' , '<STR_LIT>' ] : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> static = True , basic = False , php7 = False , wp = False , w3tc = False , <EOL> wpfc = False , wpsc = False , multisite = False , <EOL> wpsubdir = False , webroot = ee_site_webroot ) <EOL> if stype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> elif stype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> static = False , basic = True , wp = False , w3tc = False , <EOL> wpfc = False , wpsc = False , wpredis = False , multisite = False , <EOL> wpsubdir = False , webroot = ee_site_webroot , <EOL> ee_db_name = '<STR_LIT>' , ee_db_user = '<STR_LIT>' , ee_db_pass = '<STR_LIT>' , <EOL> ee_db_host = '<STR_LIT>' ) <EOL> if stype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ cache ] = True <EOL> data [ '<STR_LIT>' ] = self . app . pargs . user <EOL> data [ '<STR_LIT>' ] = self . app . pargs . email <EOL> data [ '<STR_LIT>' ] = self . app . pargs . wppass <EOL> if stype in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data [ '<STR_LIT>' ] = True <EOL> if stype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> else : <EOL> pass <EOL> if stype == "<STR_LIT:html>" and self . app . pargs . hhvm : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if data and self . app . pargs . php7 : <EOL> if ( not self . app . pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = <NUM_LIT:0> <EOL> self . app . pargs . php7 = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = <NUM_LIT:1> <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = <NUM_LIT:1> <EOL> elif data : <EOL> data [ '<STR_LIT>' ] = False <EOL> php7 = <NUM_LIT:0> <EOL> if ( not self . app . pargs . w3tc ) and ( not self . app . pargs . wpfc ) and ( not self . app . pargs . wpsc ) and ( not self . app . pargs . wpredis ) and ( not self . app . pargs . hhvm ) : <EOL> data [ '<STR_LIT>' ] = True <EOL> if data and self . app . pargs . hhvm : <EOL> if ( not self . app . pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> hhvm = <NUM_LIT:0> <EOL> self . app . pargs . hhvm = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = <NUM_LIT:1> <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = <NUM_LIT:1> <EOL> elif data : <EOL> data [ '<STR_LIT>' ] = False <EOL> hhvm = <NUM_LIT:0> <EOL> if data and self . app . pargs . pagespeed : <EOL> if ( not self . app . pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> pagespeed = <NUM_LIT:0> <EOL> self . app . pargs . pagespeed = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = <NUM_LIT:1> <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = <NUM_LIT:1> <EOL> elif data : <EOL> data [ '<STR_LIT>' ] = False <EOL> pagespeed = <NUM_LIT:0> <EOL> if ( cache == '<STR_LIT>' and ( not self . app . pargs . experimental ) ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> cache = '<STR_LIT>' <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> self . app . pargs . wpredis = False <EOL> ee_auth = site_package_check ( self , stype ) <EOL> try : <EOL> pre_run_checks ( self ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> try : <EOL> try : <EOL> setupdomain ( self , data ) <EOL> hashbucket ( self ) <EOL> except SiteError as e : <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] ) <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if '<STR_LIT>' in data . keys ( ) and data [ '<STR_LIT>' ] : <EOL> addNewSite ( self , ee_domain , stype , cache , ee_site_webroot ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if ee_auth and len ( ee_auth ) : <EOL> for msg in ee_auth : <EOL> Log . info ( self , Log . ENDC + msg , log = False ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> return <EOL> if self . app . pargs . pagespeed : <EOL> operateOnPagespeed ( self , data ) <EOL> if data [ '<STR_LIT>' ] : <EOL> php_version = "<STR_LIT>" <EOL> else : <EOL> php_version = "<STR_LIT>" <EOL> addNewSite ( self , ee_domain , stype , cache , ee_site_webroot , <EOL> hhvm = hhvm , pagespeed = pagespeed , php_version = php_version ) <EOL> if '<STR_LIT>' in data . keys ( ) and not data [ '<STR_LIT>' ] : <EOL> try : <EOL> data = setupdatabase ( self , data ) <EOL> updateSiteInfo ( self , ee_domain , db_name = data [ '<STR_LIT>' ] , <EOL> db_user = data [ '<STR_LIT>' ] , <EOL> db_password = data [ '<STR_LIT>' ] , <EOL> db_host = data [ '<STR_LIT>' ] ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] , <EOL> dbname = data [ '<STR_LIT>' ] , <EOL> dbuser = data [ '<STR_LIT>' ] , <EOL> dbhost = data [ '<STR_LIT>' ] ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> try : <EOL> eedbconfig = open ( "<STR_LIT>" <EOL> . format ( ee_site_webroot ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) <EOL> eedbconfig . write ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] ) ) <EOL> eedbconfig . close ( ) <EOL> stype = '<STR_LIT>' <EOL> except IOError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . debug ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] , <EOL> dbname = data [ '<STR_LIT>' ] , <EOL> dbuser = data [ '<STR_LIT>' ] , <EOL> dbhost = data [ '<STR_LIT>' ] ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if data [ '<STR_LIT>' ] : <EOL> try : <EOL> ee_wp_creds = setupwordpress ( self , data ) <EOL> updateSiteInfo ( self , ee_domain , db_name = data [ '<STR_LIT>' ] , <EOL> db_user = data [ '<STR_LIT>' ] , <EOL> db_password = data [ '<STR_LIT>' ] , <EOL> db_host = data [ '<STR_LIT>' ] ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] , <EOL> dbname = data [ '<STR_LIT>' ] , <EOL> dbuser = data [ '<STR_LIT>' ] , <EOL> dbhost = data [ '<STR_LIT>' ] ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] ) <EOL> if '<STR_LIT>' in data . keys ( ) : <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> dbname = data [ '<STR_LIT>' ] , <EOL> dbuser = data [ '<STR_LIT>' ] , <EOL> dbhost = data [ '<STR_LIT>' ] ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEGit . add ( self , [ "<STR_LIT>" ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_www_domain , stype , cache ) ) <EOL> try : <EOL> setwebrootpermissions ( self , data [ '<STR_LIT>' ] ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> webroot = data [ '<STR_LIT>' ] ) <EOL> if '<STR_LIT>' in data . keys ( ) : <EOL> print ( "<STR_LIT>" ) <EOL> doCleanupAction ( self , domain = ee_domain , <EOL> dbname = data [ '<STR_LIT>' ] , <EOL> dbuser = data [ '<STR_LIT>' ] , <EOL> dbhost = data [ '<STR_LIT>' ] ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if ee_auth and len ( ee_auth ) : <EOL> for msg in ee_auth : <EOL> Log . info ( self , Log . ENDC + msg , log = False ) <EOL> if data [ '<STR_LIT>' ] : <EOL> Log . info ( self , Log . ENDC + "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_wp_creds [ '<STR_LIT>' ] ) , log = False ) <EOL> Log . info ( self , Log . ENDC + "<STR_LIT>" <EOL> . format ( ee_wp_creds [ '<STR_LIT>' ] ) , log = False ) <EOL> display_cache_settings ( self , data ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> except SiteError as e : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . app . pargs . letsencrypt : <EOL> if ( not self . app . pargs . experimental ) : <EOL> if stype in [ '<STR_LIT>' ] : <EOL> Log . warn ( self , "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> data [ '<STR_LIT>' ] = False <EOL> letsencrypt = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> letsencrypt = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> letsencrypt = True <EOL> if data [ '<STR_LIT>' ] is True : <EOL> setupLetsEncrypt ( self , ee_domain ) <EOL> httpsRedirect ( self , ee_domain ) <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EECron . setcron_weekly ( self , '<STR_LIT>' . format ( ee_domain ) , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> if ( SSL . getExpirationDays ( self , ee_domain ) > <NUM_LIT:0> ) : <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDays ( self , ee_domain ) ) + "<STR_LIT>" ) <EOL> else : <EOL> Log . warn ( self , "<STR_LIT>" ) <EOL> EEGit . add ( self , [ "<STR_LIT>" . format ( ee_site_webroot ) ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> updateSiteInfo ( self , ee_domain , ssl = letsencrypt ) <EOL> elif data [ '<STR_LIT>' ] is False : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> class EESiteUpdateController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , <EOL> nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> 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>" , action = '<STR_LIT:store_true>' ) ) , <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>" , 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>" , 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>" , 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>" , 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>' 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>' , '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> action = '<STR_LIT:store>' or '<STR_LIT>' , <EOL> choices = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , const = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , nargs = '<STR_LIT:+>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ] <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def default ( self ) : <EOL> pargs = self . app . pargs <EOL> if pargs . all : <EOL> if pargs . site_name : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if pargs . html : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if not ( pargs . php or pargs . php7 or <EOL> pargs . mysql or pargs . wp or pargs . wpsubdir or <EOL> pargs . wpsubdomain or pargs . w3tc or pargs . wpfc or <EOL> pargs . wpsc or pargs . hhvm or pargs . pagespeed or pargs . wpredis or pargs . letsencrypt ) : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if pargs . all : <EOL> if pargs . site_name : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> sites = getAllsites ( self ) <EOL> if not sites : <EOL> pass <EOL> else : <EOL> for site in sites : <EOL> pargs . site_name = site . sitename <EOL> Log . info ( self , Log . ENDC + Log . BOLD + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( pargs . site_name ) ) <EOL> self . doupdatesite ( pargs ) <EOL> print ( "<STR_LIT:\n>" ) <EOL> else : <EOL> self . doupdatesite ( pargs ) <EOL> def doupdatesite ( self , pargs ) : <EOL> hhvm = None <EOL> pagespeed = None <EOL> letsencrypt = False <EOL> php7 = None <EOL> data = dict ( ) <EOL> try : <EOL> stype , cache = detSitePar ( vars ( pargs ) ) <EOL> except RuntimeError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if stype is None and pargs . proxy : <EOL> stype , cache = '<STR_LIT>' , '<STR_LIT>' <EOL> proxyinfo = pargs . proxy [ <NUM_LIT:0> ] . strip ( ) <EOL> if not proxyinfo : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> proxyinfo = proxyinfo . split ( '<STR_LIT::>' ) <EOL> host = proxyinfo [ <NUM_LIT:0> ] . strip ( ) <EOL> port = '<STR_LIT>' if len ( proxyinfo ) < <NUM_LIT:2> else proxyinfo [ <NUM_LIT:1> ] . strip ( ) <EOL> elif stype is None and not ( pargs . proxy or pargs . letsencrypt ) : <EOL> stype , cache = '<STR_LIT:html>' , '<STR_LIT>' <EOL> elif stype and pargs . proxy : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if ( pargs . proxy and ( pargs . pagespeed or pargs . hhvm ) ) : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> if not pargs . site_name : <EOL> try : <EOL> while not pargs . site_name : <EOL> pargs . site_name = ( input ( '<STR_LIT>' ) . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> pargs . site_name = pargs . site_name . strip ( ) <EOL> ( ee_domain , <EOL> ee_www_domain , ) = ValidateDomain ( pargs . site_name ) <EOL> ee_site_webroot = EEVariables . ee_webroot + ee_domain <EOL> check_site = getSiteInfo ( self , ee_domain ) <EOL> if check_site is None : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> else : <EOL> oldsitetype = check_site . site_type <EOL> oldcachetype = check_site . cache_type <EOL> old_hhvm = check_site . is_hhvm <EOL> old_pagespeed = check_site . is_pagespeed <EOL> check_ssl = check_site . is_ssl <EOL> check_php_version = check_site . php_version <EOL> if check_php_version == "<STR_LIT>" : <EOL> old_php7 = True <EOL> else : <EOL> old_php7 = False <EOL> if ( pargs . password and not ( pargs . html or <EOL> pargs . php or pargs . php7 or pargs . mysql or pargs . wp or <EOL> pargs . w3tc or pargs . wpfc or pargs . wpsc <EOL> or pargs . wpsubdir or pargs . wpsubdomain ) ) : <EOL> try : <EOL> updatewpuserpassword ( self , ee_domain , ee_site_webroot ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if ( ( stype == "<STR_LIT>" and stype == oldsitetype and self . app . pargs . hhvm ) <EOL> or ( stype == "<STR_LIT>" and <EOL> stype == oldsitetype and self . app . pargs . pagespeed ) ) : <EOL> Log . info ( self , Log . FAIL + <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if stype == "<STR_LIT:html>" and stype == oldsitetype and self . app . pargs . hhvm : <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if ( ( stype == '<STR_LIT>' and oldsitetype not in [ '<STR_LIT:html>' , '<STR_LIT>' , '<STR_LIT>' ] ) or <EOL> ( stype == '<STR_LIT>' and oldsitetype not in [ '<STR_LIT:html>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) or <EOL> ( stype == '<STR_LIT>' and oldsitetype not in [ '<STR_LIT:html>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) or <EOL> ( stype == '<STR_LIT>' and oldsitetype in [ '<STR_LIT>' ] ) or <EOL> ( stype == '<STR_LIT>' and oldsitetype in [ '<STR_LIT>' ] ) or <EOL> ( stype == oldsitetype and cache == oldcachetype ) and <EOL> not ( pargs . pagespeed or pargs . php7 ) ) : <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" . <EOL> format ( oldsitetype , oldcachetype , stype , cache ) ) <EOL> return <NUM_LIT:1> <EOL> if stype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = ee_domain <EOL> data [ '<STR_LIT>' ] = ee_www_domain <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT:host>' ] = host <EOL> data [ '<STR_LIT:port>' ] = port <EOL> pagespeed = False <EOL> hhvm = False <EOL> data [ '<STR_LIT>' ] = ee_site_webroot <EOL> data [ '<STR_LIT>' ] = oldsitetype <EOL> data [ '<STR_LIT>' ] = oldcachetype <EOL> if stype == '<STR_LIT>' : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> static = False , basic = True , wp = False , w3tc = False , <EOL> wpfc = False , wpsc = False , wpredis = False , multisite = False , <EOL> wpsubdir = False , webroot = ee_site_webroot , <EOL> currsitetype = oldsitetype , currcachetype = oldcachetype ) <EOL> elif stype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> static = False , basic = True , wp = False , w3tc = False , <EOL> wpfc = False , wpsc = False , wpredis = False , multisite = False , <EOL> wpsubdir = False , webroot = ee_site_webroot , <EOL> ee_db_name = '<STR_LIT>' , ee_db_user = '<STR_LIT>' , ee_db_pass = '<STR_LIT>' , <EOL> ee_db_host = '<STR_LIT>' , <EOL> currsitetype = oldsitetype , currcachetype = oldcachetype ) <EOL> if stype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ cache ] = True <EOL> if stype in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> data [ '<STR_LIT>' ] = True <EOL> if stype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> if pargs . pagespeed or pargs . hhvm or pargs . php7 : <EOL> if not data : <EOL> data = dict ( site_name = ee_domain , www_domain = ee_www_domain , <EOL> currsitetype = oldsitetype , <EOL> currcachetype = oldcachetype , <EOL> webroot = ee_site_webroot ) <EOL> stype = oldsitetype <EOL> cache = oldcachetype <EOL> if oldsitetype == '<STR_LIT:html>' or oldsitetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldsitetype == '<STR_LIT>' or oldsitetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldsitetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldsitetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = True <EOL> elif oldsitetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> if oldcachetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldcachetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldcachetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldcachetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> data [ '<STR_LIT>' ] = False <EOL> elif oldcachetype == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> if pargs . hhvm != '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = True <EOL> elif pargs . hhvm == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> hhvm = False <EOL> if pargs . pagespeed != '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = True <EOL> elif pargs . pagespeed == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> pagespeed = False <EOL> if pargs . php7 == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = True <EOL> check_php_version = '<STR_LIT>' <EOL> elif pargs . php7 == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> php7 = False <EOL> check_php_version = '<STR_LIT>' <EOL> if pargs . pagespeed : <EOL> if pagespeed is old_pagespeed : <EOL> if pagespeed is False : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif pagespeed is True : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> pargs . pagespeed = False <EOL> if pargs . php7 : <EOL> if php7 is old_php7 : <EOL> if php7 is False : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif php7 is True : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> pargs . php7 = False <EOL> if pargs . letsencrypt == "<STR_LIT>" and not pargs . all : <EOL> expiry_days = SSL . getExpirationDays ( self , ee_domain ) <EOL> min_expiry_days = <NUM_LIT:30> <EOL> if check_ssl : <EOL> if ( expiry_days <= min_expiry_days ) : <EOL> renewLetsEncrypt ( self , ee_domain ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> else : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> if ( SSL . getExpirationDays ( self , ee_domain ) > <NUM_LIT:0> ) : <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDays ( self , ee_domain ) ) + "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDate ( self , ee_domain ) ) ) <EOL> else : <EOL> Log . warn ( self , "<STR_LIT>" ) <EOL> if pargs . all and pargs . letsencrypt == "<STR_LIT>" : <EOL> if check_ssl : <EOL> expiry_days = SSL . getExpirationDays ( self , ee_domain , True ) <EOL> if expiry_days < <NUM_LIT:0> : <EOL> return <NUM_LIT:0> <EOL> min_expiry_days = <NUM_LIT:30> <EOL> if ( expiry_days <= min_expiry_days ) : <EOL> renewLetsEncrypt ( self , ee_domain ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> if ( SSL . getExpirationDays ( self , ee_domain ) > <NUM_LIT:0> ) : <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDays ( self , ee_domain ) ) + "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDate ( self , ee_domain ) ) ) <EOL> return <NUM_LIT:0> <EOL> else : <EOL> Log . info ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> return <NUM_LIT:0> <EOL> if pargs . all and pargs . letsencrypt == "<STR_LIT>" : <EOL> if letsencrypt is check_ssl : <EOL> if letsencrypt is False : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" , False ) <EOL> return <NUM_LIT:0> <EOL> if pargs . letsencrypt : <EOL> if pargs . letsencrypt == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = True <EOL> letsencrypt = True <EOL> elif pargs . letsencrypt == '<STR_LIT>' : <EOL> data [ '<STR_LIT>' ] = False <EOL> letsencrypt = False <EOL> if letsencrypt is check_ssl : <EOL> if letsencrypt is False : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif letsencrypt is True : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> pargs . letsencrypt = False <EOL> if pargs . hhvm : <EOL> if hhvm is old_hhvm : <EOL> if hhvm is False : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif hhvm is True : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> pargs . hhvm = False <EOL> if data and ( not pargs . hhvm ) : <EOL> if old_hhvm is True : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = False <EOL> hhvm = False <EOL> if data and ( not pargs . pagespeed ) : <EOL> if old_pagespeed is True : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = False <EOL> pagespeed = False <EOL> if data and ( not pargs . php7 ) : <EOL> if old_php7 is True : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = False <EOL> php7 = False <EOL> if pargs . pagespeed == "<STR_LIT>" or pargs . hhvm == "<STR_LIT>" or pargs . letsencrypt == "<STR_LIT>" or pargs . php7 == "<STR_LIT>" : <EOL> if pargs . php7 == "<STR_LIT>" : <EOL> if ( not pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> php7 = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> php7 = True <EOL> if pargs . hhvm == "<STR_LIT>" : <EOL> if ( not pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> hhvm = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> hhvm = True <EOL> if pargs . pagespeed == "<STR_LIT>" : <EOL> if ( not pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> pagespeed = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> pagespeed = True <EOL> if pargs . letsencrypt == "<STR_LIT>" : <EOL> if ( not pargs . experimental ) : <EOL> if oldsitetype in [ '<STR_LIT>' ] : <EOL> Log . warn ( self , "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> letsencrypt = False <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> letsencrypt = True <EOL> else : <EOL> data [ '<STR_LIT>' ] = True <EOL> letsencrypt = True <EOL> if pargs . wpredis and data [ '<STR_LIT>' ] != '<STR_LIT>' : <EOL> if ( not pargs . experimental ) : <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> check_prompt = input ( "<STR_LIT>" ) <EOL> if check_prompt != "<STR_LIT:Y>" and check_prompt != "<STR_LIT:y>" : <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> data [ '<STR_LIT>' ] = False <EOL> data [ '<STR_LIT>' ] = True <EOL> cache = '<STR_LIT>' <EOL> if ( ( hhvm is old_hhvm ) and ( pagespeed is old_pagespeed ) and ( php7 is old_php7 ) and <EOL> ( stype == oldsitetype and cache == oldcachetype ) ) : <EOL> return <NUM_LIT:1> <EOL> if not data : <EOL> Log . error ( self , "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> ee_auth = site_package_check ( self , stype ) <EOL> data [ '<STR_LIT>' ] = check_site . db_name <EOL> data [ '<STR_LIT>' ] = check_site . db_user <EOL> data [ '<STR_LIT>' ] = check_site . db_password <EOL> data [ '<STR_LIT>' ] = check_site . db_host <EOL> data [ '<STR_LIT>' ] = check_site . is_pagespeed <EOL> if not pargs . letsencrypt : <EOL> try : <EOL> pre_run_checks ( self ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> try : <EOL> sitebackup ( self , data ) <EOL> except Exception as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> try : <EOL> setupdomain ( self , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if '<STR_LIT>' in data . keys ( ) and data [ '<STR_LIT>' ] : <EOL> updateSiteInfo ( self , ee_domain , stype = stype , cache = cache , <EOL> hhvm = hhvm , pagespeed = pagespeed , ssl = True if check_site . is_ssl else False ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> return <NUM_LIT:0> <EOL> if pargs . pagespeed : <EOL> operateOnPagespeed ( self , data ) <EOL> if pargs . letsencrypt : <EOL> if data [ '<STR_LIT>' ] is True : <EOL> if not os . path . isfile ( "<STR_LIT>" <EOL> . format ( ee_site_webroot ) ) : <EOL> setupLetsEncrypt ( self , ee_domain ) <EOL> else : <EOL> EEFileUtils . mvfile ( self , "<STR_LIT>" <EOL> . format ( ee_site_webroot ) , <EOL> '<STR_LIT>' <EOL> . format ( ee_site_webroot ) ) <EOL> httpsRedirect ( self , ee_domain ) <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> EECron . setcron_weekly ( self , '<STR_LIT>' . format ( ee_domain ) , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> if ( SSL . getExpirationDays ( self , ee_domain ) > <NUM_LIT:0> ) : <EOL> Log . info ( self , "<STR_LIT>" + str ( SSL . getExpirationDays ( self , ee_domain ) ) + "<STR_LIT>" ) <EOL> else : <EOL> Log . warn ( self , "<STR_LIT>" ) <EOL> elif data [ '<STR_LIT>' ] is False : <EOL> if os . path . isfile ( "<STR_LIT>" <EOL> . format ( ee_site_webroot ) ) : <EOL> Log . info ( self , '<STR_LIT>' ) <EOL> EEFileUtils . mvfile ( self , "<STR_LIT>" <EOL> . format ( ee_site_webroot ) , <EOL> '<STR_LIT>' <EOL> . format ( ee_site_webroot ) ) <EOL> httpsRedirect ( self , ee_domain , False ) <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> EEGit . add ( self , [ "<STR_LIT>" . format ( ee_site_webroot ) ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> updateSiteInfo ( self , ee_domain , ssl = letsencrypt ) <EOL> return <NUM_LIT:0> <EOL> if stype == oldsitetype and cache == oldcachetype : <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> updateSiteInfo ( self , ee_domain , stype = stype , cache = cache , <EOL> hhvm = hhvm , pagespeed = pagespeed , ssl = True if check_site . is_ssl else False , php_version = check_php_version ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> return <NUM_LIT:0> <EOL> if '<STR_LIT>' in data . keys ( ) and not data [ '<STR_LIT>' ] : <EOL> try : <EOL> data = setupdatabase ( self , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> try : <EOL> eedbconfig = open ( "<STR_LIT>" . format ( ee_site_webroot ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:w>' ) <EOL> eedbconfig . write ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> . format ( data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] , <EOL> data [ '<STR_LIT>' ] ) ) <EOL> eedbconfig . close ( ) <EOL> except IOError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . debug ( self , "<STR_LIT>" ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if data [ '<STR_LIT>' ] and oldsitetype in [ '<STR_LIT:html>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> try : <EOL> ee_wp_creds = setupwordpress ( self , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if oldsitetype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> if data [ '<STR_LIT>' ] and oldsitetype == '<STR_LIT>' : <EOL> try : <EOL> setupwordpressnetwork ( self , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if ( oldcachetype == '<STR_LIT>' or oldcachetype == '<STR_LIT>' and <EOL> not ( data [ '<STR_LIT>' ] or data [ '<STR_LIT>' ] ) ) : <EOL> try : <EOL> uninstallwp_plugin ( self , '<STR_LIT>' , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if ( ( oldcachetype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and <EOL> ( data [ '<STR_LIT>' ] ) ) or ( oldsitetype == '<STR_LIT>' and data [ '<STR_LIT>' ] and data [ '<STR_LIT>' ] ) ) : <EOL> try : <EOL> plugin_data = '<STR_LIT>' <EOL> setupwp_plugin ( self , '<STR_LIT>' , '<STR_LIT>' , plugin_data , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> elif ( ( oldcachetype in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] and <EOL> ( data [ '<STR_LIT>' ] ) ) or ( oldsitetype == '<STR_LIT>' and data [ '<STR_LIT>' ] and data [ '<STR_LIT>' ] ) ) : <EOL> try : <EOL> plugin_data = '<STR_LIT>' <EOL> setupwp_plugin ( self , '<STR_LIT>' , '<STR_LIT>' , plugin_data , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> else : <EOL> try : <EOL> plugin_data = '<STR_LIT>' <EOL> setupwp_plugin ( self , '<STR_LIT>' , '<STR_LIT>' , plugin_data , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if oldcachetype == '<STR_LIT>' and not data [ '<STR_LIT>' ] : <EOL> try : <EOL> uninstallwp_plugin ( self , '<STR_LIT>' , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if oldcachetype == '<STR_LIT>' and not data [ '<STR_LIT>' ] : <EOL> try : <EOL> uninstallwp_plugin ( self , '<STR_LIT>' , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if ( oldcachetype != '<STR_LIT>' or oldcachetype != '<STR_LIT>' ) and ( data [ '<STR_LIT>' ] <EOL> or data [ '<STR_LIT>' ] ) : <EOL> try : <EOL> installwp_plugin ( self , '<STR_LIT>' , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if oldcachetype != '<STR_LIT>' and data [ '<STR_LIT>' ] : <EOL> try : <EOL> installwp_plugin ( self , '<STR_LIT>' , data ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if oldcachetype != '<STR_LIT>' and data [ '<STR_LIT>' ] : <EOL> try : <EOL> if installwp_plugin ( self , '<STR_LIT>' , data ) : <EOL> if EEFileUtils . isexist ( self , "<STR_LIT>" . format ( ee_site_webroot ) ) : <EOL> config_path = '<STR_LIT>' . format ( ee_site_webroot ) <EOL> elif EEFileUtils . isexist ( self , "<STR_LIT>" . format ( ee_site_webroot ) ) : <EOL> config_path = '<STR_LIT>' . format ( ee_site_webroot ) <EOL> else : <EOL> Log . debug ( self , "<STR_LIT>" ) <EOL> Log . error ( self , "<STR_LIT>" ) <EOL> raise SiteError <EOL> if EEShellExec . cmd_exec ( self , "<STR_LIT>" <EOL> . format ( config_path ) ) : <EOL> pass <EOL> else : <EOL> try : <EOL> wpconfig = open ( "<STR_LIT>" . format ( config_path ) , <EOL> encoding = '<STR_LIT:utf-8>' , mode = '<STR_LIT:a>' ) <EOL> wpconfig . write ( "<STR_LIT>" <EOL> . format ( ee_domain ) ) <EOL> wpconfig . close ( ) <EOL> except IOError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . debug ( self , "<STR_LIT>" ) <EOL> Log . warn ( self , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) + <EOL> "<STR_LIT>" ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if not EEService . reload_service ( self , '<STR_LIT>' ) : <EOL> Log . error ( self , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> EEGit . add ( self , [ "<STR_LIT>" ] , <EOL> msg = "<STR_LIT>" <EOL> . format ( ee_www_domain , stype , cache ) ) <EOL> try : <EOL> setwebrootpermissions ( self , data [ '<STR_LIT>' ] ) <EOL> except SiteError as e : <EOL> Log . debug ( self , str ( e ) ) <EOL> Log . info ( self , Log . FAIL + "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> if ee_auth and len ( ee_auth ) : <EOL> for msg in ee_auth : <EOL> Log . info ( self , Log . ENDC + msg ) <EOL> display_cache_settings ( self , data ) <EOL> if data [ '<STR_LIT>' ] and oldsitetype in [ '<STR_LIT:html>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> Log . info ( self , "<STR_LIT>" + Log . ENDC + "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_wp_creds [ '<STR_LIT>' ] ) ) <EOL> Log . info ( self , Log . ENDC + "<STR_LIT>" <EOL> . format ( ee_wp_creds [ '<STR_LIT>' ] ) + "<STR_LIT>" ) <EOL> if oldsitetype in [ '<STR_LIT:html>' , '<STR_LIT>' ] and stype != '<STR_LIT>' : <EOL> updateSiteInfo ( self , ee_domain , stype = stype , cache = cache , <EOL> db_name = data [ '<STR_LIT>' ] , <EOL> db_user = data [ '<STR_LIT>' ] , <EOL> db_password = data [ '<STR_LIT>' ] , <EOL> db_host = data [ '<STR_LIT>' ] , hhvm = hhvm , <EOL> pagespeed = pagespeed , ssl = True if check_site . is_ssl else False , php_version = check_php_version ) <EOL> else : <EOL> updateSiteInfo ( self , ee_domain , stype = stype , cache = cache , <EOL> hhvm = hhvm , pagespeed = pagespeed , ssl = True if check_site . is_ssl else False , php_version = check_php_version ) <EOL> Log . info ( self , "<STR_LIT>" <EOL> "<STR_LIT>" . format ( ee_domain ) ) <EOL> return <NUM_LIT:0> <EOL> class EESiteDeleteController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = '<STR_LIT>' <EOL> arguments = [ <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = '<STR_LIT>' , nargs = '<STR_LIT:?>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , <EOL> 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>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ( [ '<STR_LIT>' ] , <EOL> dict ( help = "<STR_LIT>" , action = '<STR_LIT:store_true>' ) ) , <EOL> ] <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> @ expose ( hide = True ) <EOL> def default ( self ) : <EOL> if not self . app . pargs . site_name : <EOL> try : <EOL> while not self . app . pargs . site_name : <EOL> self . app . pargs . site_name = ( input ( '<STR_LIT>' ) <EOL> . strip ( ) ) <EOL> except IOError as e : <EOL> Log . error ( self , '<STR_LIT>' ) <EOL> self . app . pargs . site_name = self . app . pargs . site_name . strip ( ) <EOL> ( ee_domain , ee_www_domain ) = ValidateDomain ( self . app . pargs . site_name ) <EOL> ee_db_name = '<STR_LIT>' <EOL> ee_prompt = '<STR_LIT>' <EOL> ee_nginx_prompt = '<STR_LIT>' <EOL> mark_db_delete_prompt = False <EOL> mark_webroot_delete_prompt = False <EOL> mark_db_deleted = False <EOL> mark_webroot_deleted = False <EOL> if not check_domain_exists ( self , ee_domain ) : <EOL> Log . error ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> if ( ( not self . app . pargs . db ) and ( not self . app . pargs . files ) and <EOL> ( not self . app . pargs . all ) ) : <EOL> self . app . pargs . all = True <EOL> check_site = getSiteInfo ( self , ee_domain ) <EOL> ee_site_type = check_site . site_type <EOL> ee_site_webroot = check_site . site_path <EOL> if ee_site_webroot == '<STR_LIT>' : <EOL> mark_webroot_deleted = True <EOL> if ee_site_type in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> ee_db_name = check_site . db_name <EOL> ee_db_user = check_site . db_user <EOL> ee_mysql_grant_host = self . app . config . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if ee_db_name == '<STR_LIT>' : <EOL> mark_db_deleted = True <EOL> if self . app . pargs . all : <EOL> self . app . pargs . db = True <EOL> self . app . pargs . files = True <EOL> else : <EOL> if self . app . pargs . all : <EOL> mark_db_deleted = True <EOL> self . app . pargs . files = True <EOL> if self . app . pargs . db : <EOL> if ee_db_name != '<STR_LIT>' and ee_db_name != '<STR_LIT>' : <EOL> if not self . app . pargs . no_prompt : <EOL> ee_db_prompt = input ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> else : <EOL> ee_db_prompt = '<STR_LIT:Y>' <EOL> mark_db_delete_prompt = True <EOL> if ee_db_prompt == '<STR_LIT:Y>' or ee_db_prompt == '<STR_LIT:y>' : <EOL> mark_db_delete_prompt = True <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( ee_db_name , ee_db_user ) ) <EOL> deleteDB ( self , ee_db_name , ee_db_user , ee_mysql_grant_host , False ) <EOL> updateSiteInfo ( self , ee_domain , <EOL> db_name = '<STR_LIT>' , <EOL> db_user = '<STR_LIT>' , <EOL> db_password = '<STR_LIT>' ) <EOL> mark_db_deleted = True <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> else : <EOL> mark_db_deleted = True <EOL> Log . info ( self , "<STR_LIT>" <EOL> ) <EOL> if self . app . pargs . files : <EOL> if ee_site_webroot != '<STR_LIT>' : <EOL> if not self . app . pargs . no_prompt : <EOL> ee_web_prompt = input ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> else : <EOL> ee_web_prompt = '<STR_LIT:Y>' <EOL> mark_webroot_delete_prompt = True <EOL> if ee_web_prompt == '<STR_LIT:Y>' or ee_web_prompt == '<STR_LIT:y>' : <EOL> mark_webroot_delete_prompt = True <EOL> Log . info ( self , "<STR_LIT>" <EOL> . format ( ee_site_webroot ) ) <EOL> deleteWebRoot ( self , ee_site_webroot ) <EOL> updateSiteInfo ( self , ee_domain , webroot = '<STR_LIT>' ) <EOL> mark_webroot_deleted = True <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> else : <EOL> mark_webroot_deleted = True <EOL> Log . info ( self , "<STR_LIT>" ) <EOL> if not self . app . pargs . force : <EOL> if ( mark_webroot_deleted and mark_db_deleted ) : <EOL> removeNginxConf ( self , ee_domain ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . info ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> else : <EOL> if ( mark_db_delete_prompt or mark_webroot_delete_prompt or ( mark_webroot_deleted and mark_db_deleted ) ) : <EOL> removeNginxConf ( self , ee_domain ) <EOL> deleteSiteInfo ( self , ee_domain ) <EOL> Log . info ( self , "<STR_LIT>" . format ( ee_domain ) ) <EOL> class EESiteListController ( CementBaseController ) : <EOL> class Meta : <EOL> label = '<STR_LIT:list>' <EOL> stacked_on = '<STR_LIT>' <EOL> stacked_type = '<STR_LIT>' <EOL> description = '<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> ] <EOL> @ expose ( help = "<STR_LIT>" ) <EOL> def default ( self ) : <EOL> sites = getAllsites ( self ) <EOL> if not sites : <EOL> pass <EOL> if self . app . pargs . enabled : <EOL> for site in sites : <EOL> if site . is_enabled : <EOL> Log . info ( self , "<STR_LIT>" . format ( site . sitename ) ) <EOL> elif self . app . pargs . disabled : <EOL> for site in sites : <EOL> if not site . is_enabled : <EOL> Log . info ( self , "<STR_LIT>" . format ( site . sitename ) ) <EOL> else : <EOL> for site in sites : <EOL> Log . info ( self , "<STR_LIT>" . format ( site . sitename ) ) <EOL> def load ( app ) : <EOL> handler . register ( EESiteController ) <EOL> handler . register ( EESiteCreateController ) <EOL> handler . register ( EESiteUpdateController ) <EOL> handler . register ( EESiteDeleteController ) <EOL> handler . register ( EESiteListController ) <EOL> handler . register ( EESiteEditController ) <EOL> hook . register ( '<STR_LIT>' , ee_site_hook ) </s>
