shitalp 10 years ago
parent
commit
aad68d350c
  1. 5
      ee/cli/main.py
  2. 3
      ee/cli/plugins/clean.py
  3. 43
      ee/cli/plugins/site.py
  4. 13
      ee/cli/plugins/site_functions.py

5
ee/cli/main.py

@ -30,6 +30,7 @@ defaults['ee']['plugin_dir'] = '/var/lib/ee/plugins'
# External templates (generally, do not ship with application code) # External templates (generally, do not ship with application code)
defaults['ee']['template_dir'] = '/var/lib/ee/templates' defaults['ee']['template_dir'] = '/var/lib/ee/templates'
class EEArgHandler(ArgParseArgumentHandler): class EEArgHandler(ArgParseArgumentHandler):
class Meta: class Meta:
label = 'ee_args_handler' label = 'ee_args_handler'
@ -80,6 +81,7 @@ app = EEApp()
def main(): def main():
try: try:
global sys
# Default our exit status to 0 (non-error) # Default our exit status to 0 (non-error)
code = 0 code = 0
@ -91,6 +93,9 @@ def main():
# Setup the application # Setup the application
app.setup() app.setup()
# Dump all arguments into ee log
app.log.debug(sys.argv)
# Run the application # Run the application
app.run() app.run()
except exc.EEError as e: except exc.EEError as e:

3
ee/cli/plugins/clean.py

@ -38,7 +38,8 @@ class EECleanController(CementBaseController):
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
if (not (self.app.pargs.all or self.app.pargs.fastcgi or if (not (self.app.pargs.all or self.app.pargs.fastcgi or
self.app.pargs.memcache or self.app.pargs.opcache)): self.app.pargs.memcache or self.app.pargs.opcache or
self.app.pargs.pagespeed)):
self.clean_fastcgi() self.clean_fastcgi()
if self.app.pargs.all: if self.app.pargs.all:
self.clean_memcache() self.clean_memcache()

43
ee/cli/plugins/site.py

@ -761,7 +761,10 @@ class EESiteUpdateController(CementBaseController):
.format(ee_domain)) .format(ee_domain))
ee_auth = site_package_check(self, stype) ee_auth = site_package_check(self, stype)
data['ee_db_name'] = check_site.db_name
data['ee_db_user'] = check_site.db_user
data['ee_db_pass'] = check_site.db_password
data['ee_db_host'] = check_site.db_host
try: try:
sitebackup(self, data) sitebackup(self, data)
except Exception as e: except Exception as e:
@ -814,25 +817,25 @@ class EESiteUpdateController(CementBaseController):
Log.error(self, "Update site failed. Check logs for reason " Log.error(self, "Update site failed. Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!") "`tail /var/log/ee/ee.log` & Try Again!!!")
if oldsitetype == 'mysql': # if oldsitetype == 'mysql':
config_file = (ee_site_webroot + '/backup/{0}/ee-config.php' # # config_file = (ee_site_webroot + '/backup/{0}/ee-config.php'
.format(EEVariables.ee_date)) # # .format(EEVariables.ee_date))
data['ee_db_name'] = (EEFileUtils.grep(self, config_file, # # data['ee_db_name'] = (EEFileUtils.grep(self, config_file,
'DB_NAME') # # 'DB_NAME')
.split(',')[1] # # .split(',')[1]
.split(')')[0].strip()) # # .split(')')[0].strip())
data['ee_db_user'] = (EEFileUtils.grep(self, config_file, # # data['ee_db_user'] = (EEFileUtils.grep(self, config_file,
'DB_USER') # # 'DB_USER')
.split(',')[1] # # .split(',')[1]
.split(')')[0].strip()) # # .split(')')[0].strip())
data['ee_db_pass'] = (EEFileUtils.grep(self, config_file, # # data['ee_db_pass'] = (EEFileUtils.grep(self, config_file,
'DB_PASSWORD') # # 'DB_PASSWORD')
.split(',')[1] # # .split(',')[1]
.split(')')[0].strip()) # # .split(')')[0].strip())
data['ee_db_host'] = (EEFileUtils.grep(self, config_file, # # data['ee_db_host'] = (EEFileUtils.grep(self, config_file,
'DB_HOST') # # 'DB_HOST')
.split(',')[1] # # .split(',')[1]
.split(')')[0].strip()) # # .split(')')[0].strip())
# Setup WordPress if old sites are html/php/mysql sites # Setup WordPress if old sites are html/php/mysql sites
if data['wp'] and oldsitetype in ['html', 'php', 'mysql']: if data['wp'] and oldsitetype in ['html', 'php', 'mysql']:

13
ee/cli/plugins/site_functions.py

@ -500,15 +500,16 @@ def sitebackup(self, data):
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
configfiles = glob.glob(ee_site_webroot + '/*-config.php') configfiles = glob.glob(ee_site_webroot + '/*-config.php')
# if configfiles and EEFileUtils.isexist(self, configfiles[0]):
if configfiles and EEFileUtils.isexist(self, configfiles[0]): # ee_db_name = (EEFileUtils.grep(self, configfiles[0],
ee_db_name = (EEFileUtils.grep(self, configfiles[0], # 'DB_NAME').split(',')[1]
'DB_NAME').split(',')[1] # .split(')')[0].strip().replace('\'', ''))
.split(')')[0].strip().replace('\'', '')) if data['ee_db_name']:
Log.info(self, 'Backing up database \t\t', end='') Log.info(self, 'Backing up database \t\t', end='')
try: try:
if not EEShellExec.cmd_exec(self, "mysqldump {0} > {1}/{0}.sql" if not EEShellExec.cmd_exec(self, "mysqldump {0} > {1}/{0}.sql"
.format(ee_db_name, backup_path)): .format(data['ee_db_name'],
backup_path)):
Log.info(self, Log.info(self,
"[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]") "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
raise SiteError("mysqldump failed to backup database") raise SiteError("mysqldump failed to backup database")

Loading…
Cancel
Save