Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### v3.9.x - [Unreleased]

### v3.11.3 - 2020-01-16

#### Added

- Backported Nano editor package for Debian/Ubuntu/Raspbian (which support syntax highlighting with `--nanorc`)
- Protect Easy Digital Download files from being accessed directly (PR [#222](https://github.com/WordOps/WordOps/pull/222))

#### Changed

- Improved WordOps performance by removing useless imports in `wo site` code
- Improved opcache cleaning with `wo clean --opcache`
- Force php imagick extension to be enabled after php-fpm install
- Netdata upgrade is now performed with fresh install script downloaded from github
- Update phpmyadmin to v5.0.1

#### Fixed

- Domain IP validation when using CNAME before issuing SSL certificate
- Netdata stack purge/remove not working properly
- Do not backup all databases when purging `--mysql` stack with remote MySQL server
- Netdata upgrade failure due to missing arguments

### v3.11.2 - 2019-12-07

#### Changed
Expand Down
35 changes: 22 additions & 13 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# -------------------------------------------------------------------------
# Website: https://wordops.net
# GitHub: https://github.com/WordOps/WordOps
# Copyright (c) 2019 - WordOps
# Copyright (c) 2019-2020 - WordOps
# This script is licensed under M.I.T
# -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo
# -------------------------------------------------------------------------
# Version 3.11.2 - 2019-12-07
# Version 3.11.3 - 2020-01-16
# -------------------------------------------------------------------------

# CONTENTS
Expand Down Expand Up @@ -427,22 +427,25 @@ wo_install_acme_sh() {

# WordOps install
wo_install() {
cd /usr/local/lib/python3.*/dist-packages || exit 1
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1
rm -f /usr/local/bin/wo
if [ "$wo_branch" = "master" ]; then
python3 -m pip uninstall wo -y
python3 -m pip install --upgrade wordops
else
python3 -m pip uninstall wo -y
python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3.*/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
cp -rf /usr/local/lib/python3."$python_ver"/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3."$python_ver"/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3."$python_ver"/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
}

# Clone Github repository if it doesn't exist
wo_travis_install() {

python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
if [ -d ./dist ]; then
rm -rf dist
fi
Expand All @@ -452,9 +455,9 @@ wo_travis_install() {
else
python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3.*/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
cp -rf /usr/local/lib/python3."$python_ver"/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3."$python_ver"/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3."$python_ver"/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc

}

Expand Down Expand Up @@ -584,7 +587,9 @@ wo_backup_wo() {
}

wo_clean_ee() {
rm -rf /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3.*/dist-packages/ee-*.egg /etc/ee /var/lib/ee
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
rm -rf /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3."$python_ver"/dist-packages/ee-*.egg /etc/ee /var/lib/ee
return 0
}

Expand All @@ -599,14 +604,18 @@ wo_domain_suffix() {
}

wo_clean() {
rm -rf /usr/local/lib/python3.*/dist-packages/{wo-*.egg,cement-*.egg,wordops-*.egg}
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
rm -rf /usr/local/lib/python3."$python_ver"/dist-packages/{wo-*.egg,cement-*.egg,wordops-*.egg}
}

wo_uninstall() {
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
if { python3 -m pip list | grep -q "wordops" >/dev/null 2>&1; }; then
python3 -m pip uninstall wordops -y
fi
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*,wordops-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates
rm -rf /usr/local/lib/python3."$python_ver"/dist-packages/{pystache-*,cement-2.*,wo-*,wordops-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates
}

wo_clean_repo() {
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ cement==2.10.12
pystache>=0.5.4
pynginxconfig>=0.3.4
PyMySQL>=0.9.3
psutil>=5.6.3
psutil>=5.6.7
sh>=1.12.14
SQLAlchemy>=1.3.8
SQLAlchemy>=1.3.11
requests>=2.22.0
distro>=1.4.0
argcomplete>=1.10.0
argcomplete>=1.10.3
colorlog>=4.0.2
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
os.makedirs('/var/lib/wo/tmp/')

setup(name='wordops',
version='3.11.2',
version='3.11.3',
description='An essential toolset that eases server administration',
long_description=LONG,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -65,12 +65,12 @@
'pystache >= 0.5.4',
'pynginxconfig >= 0.3.4',
'PyMySQL >= 0.9.3',
'psutil >= 5.6.3',
'psutil >= 5.6.7',
'sh >= 1.12.14',
'SQLAlchemy >= 1.3.8',
'SQLAlchemy >= 1.3.11',
'requests >= 2.22.0',
'distro >= 1.4.0',
'argcomplete >= 1.10.0',
'argcomplete >= 1.10.3',
'colorlog >= 4.0.2',
],
extras_require={ # Optional
Expand Down
18 changes: 12 additions & 6 deletions wo/cli/plugins/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,22 @@ def clean_fastcgi(self):

@expose(hide=True)
def clean_opcache(self):
opcache_dir = '/var/www/22222/htdocs/cache/opcache/'
if (os.path.exists('/usr/sbin/nginx') and
os.path.exists(
'/var/www/22222/htdocs/cache/opcache/php72.php')):
'/var/www/22222/htdocs/cache/opcache')):
try:
Log.info(self, "Cleaning opcache")
opgui = requests.get(
"http://127.0.0.1/cache/opcache/php72.php")
if opgui.status_code != '200' or opgui.status_code != '302':
Log.warn(self, 'Cleaning opcache failed')
except Exception as e:
if os.path.exists('{0}php72.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php72.php")
if os.path.exists('{0}php73.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php73.php")
if os.path.exists('{0}php74.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php74.php")
except requests.HTTPError as e:
Log.debug(self, "{0}".format(e))
Log.debug(self, "Unable hit url, "
" http://127.0.0.1/cache/opcache/"
Expand Down
12 changes: 6 additions & 6 deletions wo/cli/plugins/secure.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def secure_port(self):
Log.info(self, "Please Enter valid port number :")
port = input("WordOps admin port [22222]:")
pargs.user_input = port
WOShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen "
"{port} default_server ssl http2;/\" "
"/etc/nginx/sites-available/22222"
.format(port=pargs.user_input))
data = dict(release=WOVar.wo_version, port=port)
WOTemplate.deploy(
self, '/etc/nginx/sites-available/22222',
'22222.mustache', data)
WOGit.add(self, ["/etc/nginx"],
msg="Adding changed secure port into Git")
if not WOService.reload_service(self, 'nginx'):
Expand All @@ -145,8 +145,8 @@ def secure_ip(self):
Log.debug(self, "{0}".format(e))
user_ip = ['127.0.0.1']
for ip_addr in user_ip:
if not ("exist_ip_address "+ip_addr in open('/etc/nginx/common/'
'acl.conf').read()):
if not ("exist_ip_address " + ip_addr in open('/etc/nginx/common/'
'acl.conf').read()):
WOShellExec.cmd_exec(self, "sed -i "
"\"/deny/i allow {whitelist_address}\;\""
" /etc/nginx/common/acl.conf"
Expand Down
15 changes: 5 additions & 10 deletions wo/cli/plugins/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import subprocess

from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.site_functions import *
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo, getAllsites,
from wo.cli.plugins.site_functions import (
check_domain_exists, deleteDB, deleteWebRoot, removeNginxConf, logwatch)
from wo.cli.plugins.sitedb import (deleteSiteInfo, getAllsites,
getSiteInfo, updateSiteInfo)
from wo.cli.plugins.site_create import WOSiteCreateController
from wo.cli.plugins.site_update import WOSiteUpdateController
Expand Down Expand Up @@ -132,7 +133,6 @@ def info(self):
Log.error(self, 'could not input site name')
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
(wo_domain_type, wo_root_domain) = WODomain.getlevel(
self, wo_domain)
wo_db_name = ''
Expand All @@ -152,7 +152,6 @@ def info(self):
wo_db_name = siteinfo.db_name
wo_db_user = siteinfo.db_user
wo_db_pass = siteinfo.db_password
wo_db_host = siteinfo.db_host

php_version = siteinfo.php_version

Expand All @@ -163,7 +162,8 @@ def info(self):
else:
sslprovider = ''
sslexpiry = ''
data = dict(domain=wo_domain, webroot=wo_site_webroot,
data = dict(domain=wo_domain, domain_type=wo_domain_type,
webroot=wo_site_webroot,
accesslog=access_log, errorlog=error_log,
dbname=wo_db_name, dbuser=wo_db_user,
php_version=php_version,
Expand Down Expand Up @@ -203,7 +203,6 @@ def show(self):
# TODO Write code for wo site edit command here
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)

if not check_domain_exists(self, wo_domain):
Log.error(self, "site {0} does not exist".format(wo_domain))
Expand Down Expand Up @@ -276,12 +275,9 @@ def default(self):

pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
if not check_domain_exists(self, wo_domain):
Log.error(self, "site {0} does not exist".format(wo_domain))

wo_site_webroot = WOVar.wo_webroot + wo_domain

if os.path.isfile('/etc/nginx/sites-available/{0}'
.format(wo_domain)):
try:
Expand Down Expand Up @@ -341,7 +337,6 @@ def default(self):

pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
wo_db_name = ''
wo_prompt = ''
wo_nginx_prompt = ''
Expand Down
6 changes: 5 additions & 1 deletion wo/cli/plugins/site_create.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import os

from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.site_functions import *
from wo.cli.plugins.site_functions import (
detSitePar, check_domain_exists, site_package_check,
pre_run_checks, setupdomain, SiteError,
doCleanupAction, setupdatabase, setupwordpress, setwebrootpermissions,
display_cache_settings, copyWildcardCert)
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo,
updateSiteInfo)
from wo.core.acme import WOAcme
Expand Down
15 changes: 3 additions & 12 deletions wo/cli/plugins/site_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,28 +891,19 @@ def site_package_check(self, stype):
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php72
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
WOAptGet.is_installed(self, 'php7.4-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php72 + WOVar.wo_php_extra

if pargs.php73 and stype in ['php73', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVar.wo_php73
if not (WOAptGet.is_installed(self, 'php7.2-fpm') or
WOAptGet.is_installed(self, 'php7.4-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php73 + WOVar.wo_php_extra

if pargs.php74 and stype in ['php74', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 7.4")
if not WOAptGet.is_installed(self, 'php7.4-fpm'):
apt_packages = apt_packages + WOVar.wo_php74
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php74 + WOVar.wo_php_extra

if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for MySQL")
Expand Down
8 changes: 7 additions & 1 deletion wo/cli/plugins/site_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

from cement.core.controller import CementBaseController, expose

from wo.cli.plugins.site_functions import *
from wo.cli.plugins.site_functions import (
detSitePar, site_package_check,
pre_run_checks, setupdomain, SiteError,
setupdatabase, setupwordpress, setwebrootpermissions,
display_cache_settings, copyWildcardCert,
updatewpuserpassword, setupngxblocker, setupwp_plugin,
setupwordpressnetwork, installwp_plugin, sitebackup, uninstallwp_plugin)
from wo.cli.plugins.sitedb import (getAllsites,
getSiteInfo, updateSiteInfo)
from wo.core.acme import WOAcme
Expand Down
Loading