Browse Source

Improved Pagespeed configuration config

bugfixes
gau1991 10 years ago
parent
commit
bc3e232911
  1. 25
      ee/cli/plugins/site.py
  2. 24
      ee/cli/plugins/site_functions.py

25
ee/cli/plugins/site.py

@ -486,27 +486,6 @@ class EESiteCreateController(CementBaseController):
hhvm = False
if data and self.app.pargs.pagespeed:
if (os.path.isdir('/etc/nginx') and
(not os.path.isfile('/etc/nginx/conf.d/pagespeed.conf'))):
# Pagespeed configuration
Log.debug(self, 'Writting the Pagespeed Global '
'configuration to file /etc/nginx/conf.d/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/conf.d/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-global.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the Pagespeed common '
'configuration to file /etc/nginx/common/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/common/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-common.mustache',
out=ee_nginx)
ee_nginx.close()
data['pagespeed'] = True
pagespeed = True
elif data:
@ -1005,13 +984,17 @@ class EESiteUpdateController(CementBaseController):
if self.app.pargs.hhvm == 'on':
data['hhvm'] = True
hhvm = True
elif self.app.pargs.hhvm == 'off':
data['hhvm'] = False
hhvm = False
if self.app.pargs.pagespeed == 'on':
data['pagespeed'] = True
pagespeed = True
elif self.app.pargs.pagespeed == 'off':
data['pagespeed'] = False
pagespeed = False
if not data:
Log.error(self, " Cannot update {0}, Invalid Options"

24
ee/cli/plugins/site_functions.py

@ -467,6 +467,30 @@ def site_package_check(self, stype):
if not EEAptGet.is_installed(self, 'hhvm'):
apt_packages = apt_packages + EEVariables.ee_hhvm
# Check if Nginx is allready installed and Pagespeed config there or not
# If not then copy pagespeed config
if data and self.app.pargs.pagespeed:
if (os.path.isdir('/etc/nginx') and
(not os.path.isfile('/etc/nginx/conf.d/pagespeed.conf'))):
# Pagespeed configuration
Log.debug(self, 'Writting the Pagespeed Global '
'configuration to file /etc/nginx/conf.d/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/conf.d/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-global.mustache',
out=ee_nginx)
ee_nginx.close()
Log.debug(self, 'Writting the Pagespeed common '
'configuration to file /etc/nginx/common/'
'pagespeed.conf')
ee_nginx = open('/etc/nginx/common/pagespeed.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'pagespeed-common.mustache',
out=ee_nginx)
ee_nginx.close()
return(stack.install(apt_packages=apt_packages, packages=packages,
disp_msg=False))

Loading…
Cancel
Save