From 3a8c3cf69ba5c86703fbae40cb693db6b4e403bb Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 3 Feb 2024 19:44:14 +0500 Subject: [PATCH] bug fix: wp manager ref https://app.clickup.com/t/86enk2tcy --- plogical/DockerSites.py | 12 ++++++---- .../websiteFunctions/WPsiteHome.html | 3 +-- websiteFunctions/website.py | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 19e1663c3..a01687cf6 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -3,18 +3,20 @@ import json import os import sys import time - - - sys.path.append('/usr/local/CyberCP') -import django + +try: + import django +except: + pass try: from plogical import randomPassword from plogical.acl import ACLManager + from dockerManager.dockerInstall import DockerInstall except: pass -from dockerManager.dockerInstall import DockerInstall + from plogical.processUtilities import ProcessUtilities from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging import argparse diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index 65032cdb6..be5755b88 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -791,7 +791,6 @@ diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index ee51d9e7a..81787069b 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1076,6 +1076,29 @@ class WebsiteManager: else: return ACLManager.loadError() + + php = PHPManager.getPHPString(wpsite.owner.phpSelection) + FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) + + if AutomaticUpdates == 'Disabled': + command = f"{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set WP_AUTO_UPDATE_CORE false --raw --allow-root --path=" + wpsite.path + result = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp) + + if result.find('Success:') == -1: + raise BaseException(result) + elif AutomaticUpdates == 'Minor and Security Updates': + command = f"{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set WP_AUTO_UPDATE_CORE minor --allow-root --path=" + wpsite.path + result = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp) + + if result.find('Success:') == -1: + raise BaseException(result) + else: + command = f"{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set WP_AUTO_UPDATE_CORE true --raw --allow-root --path=" + wpsite.path + result = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp) + + if result.find('Success:') == -1: + raise BaseException(result) + wpsite.AutoUpdates = AutomaticUpdates wpsite.PluginUpdates = Plugins wpsite.ThemeUpdates = Themes