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

3
ee/cli/plugins/clean.py

@ -38,7 +38,8 @@ class EECleanController(CementBaseController):
@expose(hide=True)
def default(self):
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()
if self.app.pargs.all:
self.clean_memcache()

43
ee/cli/plugins/site.py

@ -761,7 +761,10 @@ class EESiteUpdateController(CementBaseController):
.format(ee_domain))
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:
sitebackup(self, data)
except Exception as e:
@ -814,25 +817,25 @@ class EESiteUpdateController(CementBaseController):
Log.error(self, "Update site failed. Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
if oldsitetype == 'mysql':
config_file = (ee_site_webroot + '/backup/{0}/ee-config.php'
.format(EEVariables.ee_date))
data['ee_db_name'] = (EEFileUtils.grep(self, config_file,
'DB_NAME')
.split(',')[1]
.split(')')[0].strip())
data['ee_db_user'] = (EEFileUtils.grep(self, config_file,
'DB_USER')
.split(',')[1]
.split(')')[0].strip())
data['ee_db_pass'] = (EEFileUtils.grep(self, config_file,
'DB_PASSWORD')
.split(',')[1]
.split(')')[0].strip())
data['ee_db_host'] = (EEFileUtils.grep(self, config_file,
'DB_HOST')
.split(',')[1]
.split(')')[0].strip())
# if oldsitetype == 'mysql':
# # config_file = (ee_site_webroot + '/backup/{0}/ee-config.php'
# # .format(EEVariables.ee_date))
# # data['ee_db_name'] = (EEFileUtils.grep(self, config_file,
# # 'DB_NAME')
# # .split(',')[1]
# # .split(')')[0].strip())
# # data['ee_db_user'] = (EEFileUtils.grep(self, config_file,
# # 'DB_USER')
# # .split(',')[1]
# # .split(')')[0].strip())
# # data['ee_db_pass'] = (EEFileUtils.grep(self, config_file,
# # 'DB_PASSWORD')
# # .split(',')[1]
# # .split(')')[0].strip())
# # data['ee_db_host'] = (EEFileUtils.grep(self, config_file,
# # 'DB_HOST')
# # .split(',')[1]
# # .split(')')[0].strip())
# Setup WordPress if old sites are html/php/mysql sites
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 + "]")
configfiles = glob.glob(ee_site_webroot + '/*-config.php')
if configfiles and EEFileUtils.isexist(self, configfiles[0]):
ee_db_name = (EEFileUtils.grep(self, configfiles[0],
'DB_NAME').split(',')[1]
.split(')')[0].strip().replace('\'', ''))
# if configfiles and EEFileUtils.isexist(self, configfiles[0]):
# ee_db_name = (EEFileUtils.grep(self, configfiles[0],
# 'DB_NAME').split(',')[1]
# .split(')')[0].strip().replace('\'', ''))
if data['ee_db_name']:
Log.info(self, 'Backing up database \t\t', end='')
try:
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.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
raise SiteError("mysqldump failed to backup database")

Loading…
Cancel
Save