Fixes on PHP backend
This commit is contained in:
parent
2160f79ce4
commit
bea80f3edc
|
@ -72,8 +72,8 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
||||||
} || {
|
} || {
|
||||||
echo -e "${wrapper}" > %(wrapper_path)s
|
echo -e "${wrapper}" > %(wrapper_path)s
|
||||||
if [[ %(is_mounted)i -eq 1 ]]; then
|
if [[ %(is_mounted)i -eq 1 ]]; then
|
||||||
# Reload fcgid wrapper
|
# Reload fcgid wrapper (all versions to support version changing)
|
||||||
pkill -SIGHUP -U %(user)s "^%(php_binary)s$" || true
|
pkill -SIGHUP -U %(user)s "^php[0-9\.]+-cgi$" || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
""") % context
|
""") % context
|
||||||
|
@ -112,33 +112,32 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
||||||
data__contains='"php_version":"%s"' % context['php_version'],
|
data__contains='"php_version":"%s"' % context['php_version'],
|
||||||
).exclude(id=webapp.pk).exists()
|
).exclude(id=webapp.pk).exists()
|
||||||
|
|
||||||
def delete_fpm(self, webapp, context, preserve=False):
|
def all_versions_to_delete(self, webapp, context, preserve=False):
|
||||||
""" delete all pools in order to efectively support changing php-fpm version """
|
|
||||||
context_copy = dict(context)
|
context_copy = dict(context)
|
||||||
for php_version, verbose in settings.WEBAPPS_PHP_VERSIONS:
|
for php_version, verbose in settings.WEBAPPS_PHP_VERSIONS:
|
||||||
if preserve and php_version == context['php_version']:
|
if preserve and php_version == context['php_version']:
|
||||||
continue
|
continue
|
||||||
php_version_number = utils.extract_version_number(php_version)
|
php_version_number = utils.extract_version_number(php_version)
|
||||||
|
context_copy['php_version'] = php_version
|
||||||
context_copy['php_version_number'] = php_version_number
|
context_copy['php_version_number'] = php_version_number
|
||||||
if not self.MERGE or not self.has_sibilings(webapp, context_copy):
|
if not self.MERGE or not self.has_sibilings(webapp, context_copy):
|
||||||
context_copy['fpm_path'] = settings.WEBAPPS_PHPFPM_POOL_PATH % context_copy
|
yield context_copy
|
||||||
self.append("rm -f %(fpm_path)s" % context_copy)
|
|
||||||
|
def delete_fpm(self, webapp, context, preserve=False):
|
||||||
|
""" delete all pools in order to efectively support changing php-fpm version """
|
||||||
|
for context_copy in self.all_versions_to_delete(webapp, context, preserve):
|
||||||
|
context_copy['fpm_path'] = settings.WEBAPPS_PHPFPM_POOL_PATH % context_copy
|
||||||
|
self.append("rm -f %(fpm_path)s" % context_copy)
|
||||||
|
|
||||||
def delete_fcgid(self, webapp, context, preserve=False):
|
def delete_fcgid(self, webapp, context, preserve=False):
|
||||||
""" delete all pools in order to efectively support changing php-fcgid version """
|
""" delete all pools in order to efectively support changing php-fcgid version """
|
||||||
context_copy = dict(context)
|
for context_copy in self.all_versions_to_delete(webapp, context, preserve):
|
||||||
for php_version, verbose in settings.WEBAPPS_PHP_VERSIONS:
|
context_copy.update({
|
||||||
if preserve and php_version == context['php_version']:
|
'wrapper_path': settings.WEBAPPS_FCGID_WRAPPER_PATH % context_copy,
|
||||||
continue
|
'cmd_options_path': settings.WEBAPPS_FCGID_CMD_OPTIONS_PATH % context_copy,
|
||||||
php_version_number = utils.extract_version_number(php_version)
|
})
|
||||||
context_copy['php_version_number'] = php_version_number
|
self.append("rm -f %(wrapper_path)s" % context_copy)
|
||||||
if not self.MERGE or not self.has_sibilings(webapp, context_copy):
|
self.append("rm -f %(cmd_options_path)s" % context_copy)
|
||||||
context_copy.update({
|
|
||||||
'wrapper_path': settings.WEBAPPS_FCGID_WRAPPER_PATH % context_copy,
|
|
||||||
'cmd_options_path': settings.WEBAPPS_FCGID_CMD_OPTIONS_PATH % context_copy,
|
|
||||||
})
|
|
||||||
self.append("rm -f %(wrapper_path)s" % context_copy)
|
|
||||||
self.append("rm -f %(cmd_options_path)s" % context_copy)
|
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
super(PHPBackend, self).prepare()
|
super(PHPBackend, self).prepare()
|
||||||
|
|
Loading…
Reference in New Issue