mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 05:15:49 +01:00
bug fix. cpupgrade
This commit is contained in:
@@ -1659,12 +1659,14 @@ class CloudManager:
|
||||
destinationDomain = 'None'
|
||||
|
||||
import time
|
||||
BackupPath = '/home/cyberpanel/backups/%s/backup-' % (self.data['domain']) + self.data['domain'] + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||
BackupPath = '/home/cyberpanel/backups/%s/backup-' % (self.data['domain']) + self.data[
|
||||
'domain'] + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " CloudBackup --backupDomain %s --data %s --emails %s --databases %s --tempStoragePath %s " \
|
||||
"--path %s --port %s --ip %s --destinationDomain %s" % (
|
||||
self.data['domain'], data, emails, databases, tempStatusPath, BackupPath, port, ip, destinationDomain)
|
||||
self.data['domain'], data, emails, databases, tempStatusPath, BackupPath, port, ip,
|
||||
destinationDomain)
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
|
||||
final_dic = {'status': 1, 'tempStatusPath': tempStatusPath, 'path': '%s.tar.gz' % (BackupPath)}
|
||||
@@ -1784,7 +1786,7 @@ class CloudManager:
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " SubmitCloudBackupRestore --backupDomain %s --backupFile %s --sourceDomain %s --tempStoragePath %s" % (
|
||||
self.data['domain'], self.data['backupFile'],sourceDomain, tempStatusPath)
|
||||
self.data['domain'], self.data['backupFile'], sourceDomain, tempStatusPath)
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
|
||||
final_dic = {'status': 1, 'tempStatusPath': tempStatusPath}
|
||||
@@ -1957,7 +1959,6 @@ class CloudManager:
|
||||
finalDic['maintenanceMode'] = 1
|
||||
finalDic['php'] = '7.4'
|
||||
|
||||
|
||||
## Get versopm
|
||||
|
||||
website = Websites.objects.get(domain=domain)
|
||||
@@ -1997,7 +1998,8 @@ class CloudManager:
|
||||
## Search index
|
||||
|
||||
command = 'wp option get blog_public --path=%s' % (path)
|
||||
finalDic['searchIndex'] = int(ProcessUtilities.outputExecutioner(command, website.externalApp).splitlines()[-1])
|
||||
finalDic['searchIndex'] = int(
|
||||
ProcessUtilities.outputExecutioner(command, website.externalApp).splitlines()[-1])
|
||||
|
||||
## Maintenece mode
|
||||
|
||||
@@ -2043,7 +2045,8 @@ class CloudManager:
|
||||
import plogical.randomPassword as randomPassword
|
||||
password = randomPassword.generate_pass(32)
|
||||
|
||||
command = 'wp user create cyberpanel support@cyberpanel.cloud --role=administrator --user_pass="%s" --path=%s' % (password, path)
|
||||
command = 'wp user create cyberpanel support@cyberpanel.cloud --role=administrator --user_pass="%s" --path=%s' % (
|
||||
password, path)
|
||||
ProcessUtilities.executioner(command, website.externalApp)
|
||||
|
||||
command = 'wp user update cyberpanel --user_pass="%s" --path=%s' % (password, path)
|
||||
@@ -2072,7 +2075,6 @@ class CloudManager:
|
||||
except:
|
||||
path = '/home/%s/public_html' % (self.data['domain'])
|
||||
|
||||
|
||||
if self.data['setting'] == 'lscache':
|
||||
if self.data['settingValue']:
|
||||
|
||||
@@ -2196,7 +2198,8 @@ class CloudManager:
|
||||
if self.data['plugin'] == 'all':
|
||||
command = 'wp plugin update --all --path=%s' % (path)
|
||||
ProcessUtilities.popenExecutioner(command, website.externalApp)
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'message': "Plugin updates started in the background."})
|
||||
final_json = json.dumps(
|
||||
{'status': 1, 'fetchStatus': 1, 'message': "Plugin updates started in the background."})
|
||||
return HttpResponse(final_json)
|
||||
elif self.data['plugin'] == 'selected':
|
||||
if self.data['allPluginsChecked']:
|
||||
@@ -2338,7 +2341,8 @@ class CloudManager:
|
||||
if self.data['plugin'] == 'all':
|
||||
command = 'wp theme update --all --path=%s' % (path)
|
||||
ProcessUtilities.popenExecutioner(command, website.externalApp)
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'message': "Theme updates started in the background."})
|
||||
final_json = json.dumps(
|
||||
{'status': 1, 'fetchStatus': 1, 'message': "Theme updates started in the background."})
|
||||
return HttpResponse(final_json)
|
||||
elif self.data['plugin'] == 'selected':
|
||||
if self.data['allPluginsChecked']:
|
||||
@@ -2567,7 +2571,6 @@ class CloudManager:
|
||||
if cronLine.find('WPAutoUpdates.py') > -1:
|
||||
finalCron = cronLine
|
||||
|
||||
|
||||
if finalCron.find('WPAutoUpdates.py') == -1:
|
||||
finalCron = 'Not Set'
|
||||
|
||||
@@ -2614,7 +2617,8 @@ class CloudManager:
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if result.find('Error:') > -1:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': 'This does not seem to be a WordPress installation'}
|
||||
final_dic = {'status': 0, 'fetchStatus': 0,
|
||||
'error_message': 'This does not seem to be a WordPress installation'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
@@ -2628,8 +2632,24 @@ class CloudManager:
|
||||
|
||||
def SubmitCyberPanelUpgrade(self):
|
||||
try:
|
||||
try:
|
||||
mail = str(int(self.data['mail']))
|
||||
except:
|
||||
mail = '0'
|
||||
|
||||
try:
|
||||
dns = str(int(self.data['dns']))
|
||||
except:
|
||||
dns = '0'
|
||||
|
||||
try:
|
||||
ftp = str(int(self.data['ftp']))
|
||||
except:
|
||||
ftp = '0'
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/CyberPanelUpgrade.py --branch %s --mail %s --dns %s --ftp %s" % (
|
||||
self.data['CyberPanelBranch'], mail, dns, ftp)
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/CyberPanelUpgrade.py"
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
final_json = json.dumps({'status': 1})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -104,7 +104,7 @@ echo -e "\n${1}=${2}\n" >> /tmp/cyberpanel_debug.log
|
||||
Debug_Log2() {
|
||||
Check_Server_IP "$@"
|
||||
echo -e "\n${1}" >> /var/log/installLogs.txt
|
||||
curl -d '{"ipAddress": "'"$Server_IP"'", "InstallCyberPanelStatus": "'"$1"'"}' -H "Content-Type: application/json" -X POST http://cloud.cyberpanel.net:8000/servers/RecvData > /dev/null
|
||||
curl -d '{"ipAddress": "'"$Server_IP"'", "InstallCyberPanelStatus": "'"$1"'"}' -H "Content-Type: application/json" -X POST https://cloud.cyberpanel.net/servers/RecvData > /dev/null
|
||||
}
|
||||
|
||||
Branch_Check() {
|
||||
|
||||
@@ -7,7 +7,7 @@ import requests
|
||||
class InstallLog:
|
||||
fileName = "/var/log/installLogs.txt"
|
||||
currentPercent = '10'
|
||||
LogURL = 'http://cloud.cyberpanel.net:8000/servers/RecvData'
|
||||
LogURL = 'https://cloud.cyberpanel.net/servers/RecvData'
|
||||
ServerIP = ''
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import argparse
|
||||
@@ -17,17 +16,87 @@ class UpgradeCyberPanel:
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
self.ipAddress = ipData.split('\n', 1)[0]
|
||||
self.branch = branch
|
||||
self.mail = mail
|
||||
self.ftp = ftp
|
||||
self.dns = dns
|
||||
|
||||
def PostStatus(self, message):
|
||||
finalData = json.dumps({'ipAddress': self.ipAddress, "UpgradeCyberPanelStatus": message})
|
||||
resp = requests.post(UpgradeCyberPanel.LogURL, data=finalData, verify=False)
|
||||
print (resp.text)
|
||||
|
||||
def RestoreOldCP(self):
|
||||
|
||||
from plogical.upgrade import Upgrade
|
||||
|
||||
command = 'rm -rf /usr/local/CyberCP'
|
||||
Upgrade.executioner(command, command)
|
||||
|
||||
command = 'mv /usr/local/CyberCPBak /usr/local/CyberCP'
|
||||
Upgrade.executioner(command, command)
|
||||
Upgrade.fixPermissions()
|
||||
|
||||
|
||||
def UpgardeNow(self):
|
||||
self.PostStatus('Upgrade in route..,35')
|
||||
import time
|
||||
time.sleep(10)
|
||||
self.PostStatus('Upgrade completed. [200]')
|
||||
|
||||
from plogical.upgrade import Upgrade
|
||||
|
||||
self.PostStatus('Backing up current installation..,5' % (self.branch))
|
||||
|
||||
command = 'cp -R /usr/local/CyberCP /usr/local/CyberCPBak'
|
||||
Upgrade.executioner(command, command)
|
||||
|
||||
self.PostStatus('Upgrading/Downgrading to branch %s..,10' % (self.branch))
|
||||
|
||||
status, message = Upgrade.downloadAndUpgrade(None, self.branch)
|
||||
|
||||
if status == 0:
|
||||
self.RestoreOldCP()
|
||||
self.PostStatus('Failed to upgrade, error %s.[404]' % (message))
|
||||
return 0
|
||||
|
||||
self.PostStatus('CyberPanel is now on %s..,40' % (self.branch))
|
||||
|
||||
##
|
||||
|
||||
self.PostStatus('Updating database..,45')
|
||||
|
||||
Upgrade.mailServerMigrations()
|
||||
Upgrade.emailMarketingMigrationsa()
|
||||
Upgrade.dockerMigrations()
|
||||
Upgrade.CLMigrations()
|
||||
Upgrade.IncBackupMigrations()
|
||||
Upgrade.applyLoginSystemMigrations()
|
||||
Upgrade.s3BackupMigrations()
|
||||
Upgrade.containerMigrations()
|
||||
Upgrade.manageServiceMigrations()
|
||||
|
||||
self.PostStatus('Database updated.,55')
|
||||
|
||||
|
||||
## Put function here to update custom ACLs
|
||||
|
||||
Upgrade.UpdateConfigOfCustomACL()
|
||||
Upgrade.enableServices()
|
||||
Upgrade.someDirectories()
|
||||
Upgrade.GeneralMigrations()
|
||||
|
||||
## Upgrade version
|
||||
|
||||
self.PostStatus('Fixing permissions,70')
|
||||
|
||||
Upgrade.fixPermissions()
|
||||
|
||||
##
|
||||
|
||||
Upgrade.upgradeVersion()
|
||||
Upgrade.UpdateMaxSSLCons()
|
||||
|
||||
self.PostStatus('CyberPanel Upgraded/Downgraded to %s. [200]' % (self.branch))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
@@ -39,7 +108,7 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
uc = UpgradeCyberPanel(1,1,1,1)
|
||||
uc = UpgradeCyberPanel(args.branch,int(args.mail),int(args.dns),int(args.ftp))
|
||||
uc.UpgardeNow()
|
||||
|
||||
|
||||
|
||||
@@ -1772,8 +1772,10 @@ imap_folder_list_limit = 0
|
||||
|
||||
Upgrade.staticContent()
|
||||
|
||||
except:
|
||||
pass
|
||||
return 1, None
|
||||
|
||||
except BaseException as msg:
|
||||
return 0, str(msg)
|
||||
|
||||
@staticmethod
|
||||
def installLSCPD(branch):
|
||||
|
||||
Reference in New Issue
Block a user