feat: convert WordOps from Nginx to OpenLiteSpeed + LSPHP + LSCache
Complete conversion of the WordOps stack from Nginx + PHP-FPM to OpenLiteSpeed + LSPHP + LSCache. This is a full rewrite across all 7 phases of the codebase: - Foundation: OLS paths, variables, services, removed pynginxconfig dep - Templates: 11 new OLS mustache templates, removed nginx-specific ones - Stack: stack_pref, stack, stack_services, stack_upgrade, stack_migrate - Site: site_functions, site, site_create, site_update - Plugins: debug, info, log, clean rewritten for OLS - SSL/ACME: acme.sh deploy uses lswsctrl, OLS vhssl blocks - Other: secure, backup, clone, install script Additional features: - Debian 13 (trixie) support - PHP 8.5 support - WP Fort Knox mu-plugin integration (wo secure --lockdown/--unlock) - --nginx CLI flag preserved for backward compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,49 +1,6 @@
|
||||
"""WordOps Hash Bucket Calculator"""
|
||||
import fileinput
|
||||
import math
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from wo.core.fileutils import WOFileUtils
|
||||
"""Deprecated: OLS does not require hash bucket configuration"""
|
||||
|
||||
|
||||
def hashbucket(self):
|
||||
# Check Nginx Hashbucket error
|
||||
sub = subprocess.Popen('nginx -t', stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, shell=True)
|
||||
output, error_output = sub.communicate()
|
||||
if 'server_names_hash_bucket_size' not in str(error_output):
|
||||
return True
|
||||
|
||||
count = 0
|
||||
# Get the list of sites-availble
|
||||
sites_list = os.listdir("/etc/nginx/sites-enabled/")
|
||||
|
||||
# Count the number of characters in site names
|
||||
for site in sites_list:
|
||||
count = sum([count, len(site)])
|
||||
|
||||
# Calculate Nginx hash bucket size
|
||||
ngx_calc = math.trunc(sum([math.log(count, 2), 2]))
|
||||
ngx_hash = math.trunc(math.pow(2, ngx_calc))
|
||||
|
||||
# Replace hashbucket in Nginx.conf file
|
||||
if WOFileUtils.grepcheck(self, "/etc/nginx/nginx.conf",
|
||||
"# server_names_hash_bucket_size 64;"):
|
||||
ngxconf = open("/etc/nginx/conf.d/hashbucket.conf",
|
||||
encoding='utf-8', mode='w')
|
||||
ngxconf.write("\tserver_names_hash_bucket_size {0};".format(ngx_hash))
|
||||
ngxconf.close()
|
||||
elif WOFileUtils.grepcheck(self, "/etc/nginx/nginx/conf",
|
||||
"server_names_hash_bucket_size"):
|
||||
for line in fileinput.FileInput("/etc/nginx/nginx.conf", inplace=1):
|
||||
if "server_names_hash_bucket_size" in line:
|
||||
print("\tserver_names_hash_bucket_size {0};".format(ngx_hash))
|
||||
else:
|
||||
print(line, end='')
|
||||
|
||||
else:
|
||||
ngxconf = open("/etc/nginx/conf.d/hashbucket.conf",
|
||||
encoding='utf-8', mode='w')
|
||||
ngxconf.write("\tserver_names_hash_bucket_size {0};".format(ngx_hash))
|
||||
ngxconf.close()
|
||||
"""No-op: OpenLiteSpeed does not need hash bucket configuration"""
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user