diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 8be95629..c0d3d655 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -336,6 +336,8 @@ class EESiteCreateController(CementBaseController): dict(help="create html site", action='store_true')), (['--php'], dict(help="create php site", action='store_true')), + (['--php7'], + dict(help="create php site", action='store_true')), (['--mysql'], dict(help="create mysql site", action='store_true')), (['--wp'], @@ -441,13 +443,13 @@ class EESiteCreateController(CementBaseController): data['port'] = port ee_site_webroot = "" - if stype in ['html', 'php']: + if stype in ['html', 'php' , 'php7']: data = dict(site_name=ee_domain, www_domain=ee_www_domain, static=True, basic=False, wp=False, w3tc=False, wpfc=False, wpsc=False, multisite=False, wpsubdir=False, webroot=ee_site_webroot) - if stype == 'php': + if stype == 'php' or stype == 'php7': data['static'] = False data['basic'] = True @@ -477,6 +479,29 @@ class EESiteCreateController(CementBaseController): if stype == "html" and self.app.pargs.hhvm: Log.error(self, "Can not create HTML site with HHVM") + if data and self.app.pargs.php7: + if (not self.app.pargs.experimental): + Log.info(self, "PHP7.0 is experimental feature and it may not " + "work with all CSS/JS/Cache of your site.\nDo you wish" + " to install PHP 7.0 now for {0}?".format(ee_domain)) + + # Check prompt + check_prompt = input("Type \"y\" to continue [n]:") + if check_prompt != "Y" and check_prompt != "y": + Log.info(self, "Not using PHP 7.0 for site.") + data['php7'] = False + php7 = 0 + self.app.pargs.php7 = False + else: + data['php7'] = True + php7 = 1 + else: + data['php7'] = True + php7 = 1 + elif data: + data['php7'] = False + php7 = 0 + if data and self.app.pargs.hhvm: if (not self.app.pargs.experimental): Log.info(self, "HHVM is experimental feature and it may not " diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 38232fca..642e4e97 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -699,10 +699,29 @@ def site_package_check(self, stype): ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') - if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if self.app.pargs.php and self.app.pargs.php7: + Log.error(self,"INVALID OPTION: PHP 7.0 provided with PHP 5.0") + + if not self.app.pargs.php7 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for PHP") - if not EEAptGet.is_installed(self, 'php5-fpm'): - apt_packages = apt_packages + EEVariables.ee_php + if EEVariables.ee_platform_codename != 'trusty': + if not EEAptGet.is_installed(self, 'php5-fpm'): + apt_packages = apt_packages + EEVariables.ee_php + else: + if not EEAptGet.is_installed(self, 'php5.6-fpm'): + apt_packages = apt_packages + EEVariables.ee_php5_6 + + if self.app.pargs.php7 and stype in [ 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']: + if EEVariables.ee_platform_codename == 'trusty': + Log.debug(self, "Setting apt_packages variable for PHP 7.0") + if not EEAptGet.is_installed(self, 'php7-fpm'): + apt_packages = apt_packages + EEVariables.ee_php7_0 + else: + Log.warn(self, "PHP 7.0 not available for your system.") + Log.info(self, "Setting apt_packages variable for PHP 5.0") + Log.debug(self, "Setting apt_packages variable for PHP 5.0") + if not EEAptGet.is_installed(self, 'php5-fpm'): + apt_packages = apt_packages + EEVariables.ee_php5_6 if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: Log.debug(self, "Setting apt_packages variable for MySQL")