From b85a81ad8d7a2634a7e39cb7f836c19dd8b9153a Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 29 Jul 2019 02:32:53 +0200 Subject: [PATCH] Few code quality improvements --- CHANGELOG.md | 1 + wo/cli/plugins/debug.py | 2 +- wo/cli/plugins/import_slow_log.py | 3 --- wo/cli/plugins/info.py | 3 +-- wo/cli/plugins/site_functions.py | 36 +++++++++++++++---------------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6b8858..522491f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - MySQL configuration tuning - Cronjob to optimize MySQL databases weekly - WO-kernel systemd service to automatically apply kernel tweaks on server startup +- Brotli configuration with only well compressible MIME types #### Changed diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 1c29c68..6607ecb 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -753,7 +753,7 @@ class WODebugController(CementBaseController): self.debug_fpm73() if self.app.pargs.mysql: # MySQL debug will not work for remote MySQL - if WOVariables.wo_mysql_host is "localhost": + if WOVariables.wo_mysql_host == "localhost": self.debug_mysql() else: Log.warn(self, "Remote MySQL found, WordOps does not support " diff --git a/wo/cli/plugins/import_slow_log.py b/wo/cli/plugins/import_slow_log.py index 4716cad..6e51b51 100644 --- a/wo/cli/plugins/import_slow_log.py +++ b/wo/cli/plugins/import_slow_log.py @@ -1,9 +1,6 @@ from cement.core.controller import CementBaseController, expose from cement.core import handler, hook -from wo.core.shellexec import WOShellExec from wo.core.logging import Log -from wo.core.variables import WOVariables -import os def wo_import_slow_log_hook(app): diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index f478ccb..2e9833d 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -2,7 +2,6 @@ from cement.core.controller import CementBaseController, expose from cement.core import handler, hook -from wo.core.variables import WOVariables from pynginxconfig import NginxConfig from wo.core.aptget import WOAptGet from wo.core.shellexec import WOShellExec @@ -279,7 +278,7 @@ class WOInfoController(CementBaseController): Log.error(self, "PHP 7.3 is not installed") if self.app.pargs.mysql: - if WOShellExec.cmd_exec(self, "mysqladmin ping"): + if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"): self.info_mysql() else: Log.error(self, "MySQL is not installed") diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 99d399f..cbe6011 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -1,25 +1,23 @@ -from wo.cli.plugins.stack import WOStackController -from wo.core.fileutils import WOFileUtils -from wo.core.mysql import * -from wo.core.shellexec import WOShellExec, CommandExecutionError -from wo.core.sslutils import SSL -from wo.core.variables import WOVariables -from wo.cli.plugins.sitedb import * -from wo.core.aptget import WOAptGet -from wo.core.git import WOGit -from wo.core.logging import Log -from wo.core.sendmail import WOSendMail -from wo.core.services import WOService -import subprocess -from subprocess import CalledProcessError -import os -import random -import string -import sys import getpass import glob +import os +import random import re -import platform +import string +import subprocess +from subprocess import CalledProcessError + +from wo.cli.plugins.sitedb import * +from wo.cli.plugins.stack import WOStackController +from wo.core.aptget import WOAptGet +from wo.core.fileutils import WOFileUtils +from wo.core.git import WOGit +from wo.core.logging import Log +from wo.core.mysql import * +from wo.core.services import WOService +from wo.core.shellexec import CommandExecutionError, WOShellExec +from wo.core.sslutils import SSL +from wo.core.variables import WOVariables class SiteError(Exception):