mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
some bug fixes in wp manager
This commit is contained in:
@@ -211,21 +211,25 @@ def FileManagerRoot(request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
from plogical.processUtilities import ProcessUtilities
|
||||||
data = {
|
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||||
"name": "Filemanager",
|
|
||||||
"IP": ipAddressLocal
|
|
||||||
}
|
|
||||||
|
|
||||||
import requests
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
response = requests.post(url, data=json.dumps(data))
|
data = {
|
||||||
Status = response.json()['status']
|
"name": "Filemanager",
|
||||||
|
"IP": ipAddressLocal
|
||||||
|
}
|
||||||
|
|
||||||
if(Status == 1):
|
import requests
|
||||||
template = 'baseTemplate/FileManager.html'
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
|
if(Status == 1):
|
||||||
|
template = 'baseTemplate/FileManager.html'
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
else:
|
else:
|
||||||
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
template = 'baseTemplate/FileManager.html'
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
template = 'baseTemplate/FileManager.html'
|
template = 'baseTemplate/FileManager.html'
|
||||||
|
|
||||||
|
|||||||
@@ -383,6 +383,8 @@ class IncScheduler(multi.Thread):
|
|||||||
|
|
||||||
#logging.writeToFile('job completed')
|
#logging.writeToFile('job completed')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
data = {
|
data = {
|
||||||
"name": "backups-retention",
|
"name": "backups-retention",
|
||||||
@@ -393,7 +395,7 @@ class IncScheduler(multi.Thread):
|
|||||||
response = requests.post(url, data=json.dumps(data))
|
response = requests.post(url, data=json.dumps(data))
|
||||||
Status = response.json()['status']
|
Status = response.json()['status']
|
||||||
|
|
||||||
if (Status == 1):
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
page_token = None
|
page_token = None
|
||||||
@@ -457,7 +459,6 @@ class IncScheduler(multi.Thread):
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
print('An error occurred fetch child: %s' % msg)
|
print('An error occurred fetch child: %s' % msg)
|
||||||
logging.writeToFile('An error occurred fetch child: %s' % msg)
|
logging.writeToFile('An error occurred fetch child: %s' % msg)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile('job not completed [ERROR:]..%s'%msg)
|
logging.writeToFile('job not completed [ERROR:]..%s'%msg)
|
||||||
|
|
||||||
|
|||||||
@@ -931,4 +931,30 @@ class ACLManager:
|
|||||||
|
|
||||||
return wpsites
|
return wpsites
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetServerIP():
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
return ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def CheckForPremFeature(feature):
|
||||||
|
try:
|
||||||
|
|
||||||
|
if ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": feature,
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
return response.json()['status']
|
||||||
|
except:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
from django.shortcuts import HttpResponse, render
|
from django.shortcuts import HttpResponse, render, redirect
|
||||||
from loginSystem.models import Administrator, ACL
|
from loginSystem.models import Administrator, ACL
|
||||||
from packages.models import Package
|
from packages.models import Package
|
||||||
from plogical.mailUtilities import mailUtilities
|
from plogical.mailUtilities import mailUtilities
|
||||||
@@ -60,31 +60,44 @@ class WebsiteManager:
|
|||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
def WPCreate(self, request=None, userID=None, data=None):
|
def WPCreate(self, request=None, userID=None, data=None):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
data = {
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
"name": "wp-manager",
|
||||||
FinalVersions = []
|
"IP": ACLManager.GetServerIP()
|
||||||
userobj = Administrator.objects.get(pk=userID)
|
}
|
||||||
counter = 0
|
|
||||||
try:
|
|
||||||
import requests
|
|
||||||
WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)['offers']
|
|
||||||
|
|
||||||
for versions in WPVersions:
|
import requests
|
||||||
if counter == 7:
|
response = requests.post(url, data=json.dumps(data))
|
||||||
break
|
Status = response.json()['status']
|
||||||
if versions['current'] not in FinalVersions:
|
|
||||||
FinalVersions.append(versions['current'])
|
|
||||||
counter = counter + 1
|
|
||||||
except:
|
|
||||||
FinalVersions = ['5.6', '5.5.3', '5.5.2']
|
|
||||||
|
|
||||||
Plugins = wpplugins.objects.filter(owner=userobj)
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
|
FinalVersions = []
|
||||||
|
userobj = Administrator.objects.get(pk=userID)
|
||||||
|
counter = 0
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)['offers']
|
||||||
|
|
||||||
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins }
|
for versions in WPVersions:
|
||||||
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
if counter == 7:
|
||||||
Data, 'createWebsite')
|
break
|
||||||
return proc.render()
|
if versions['current'] not in FinalVersions:
|
||||||
|
FinalVersions.append(versions['current'])
|
||||||
|
counter = counter + 1
|
||||||
|
except:
|
||||||
|
FinalVersions = ['5.6', '5.5.3', '5.5.2']
|
||||||
|
|
||||||
|
Plugins = wpplugins.objects.filter(owner=userobj)
|
||||||
|
|
||||||
|
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins }
|
||||||
|
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
||||||
|
Data, 'createWebsite')
|
||||||
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def ListWPSites(self, request=None, userID=None, DeleteID=None):
|
def ListWPSites(self, request=None, userID=None, DeleteID=None):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -126,89 +139,116 @@ class WebsiteManager:
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
Data['wpsite'] = WPobj
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
import requests
|
||||||
DeleteID = request.GET.get('DeleteID', None)
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
if DeleteID != None:
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
wstagingDelete = WPStaging.objects.get(pk=DeleteID, owner=WPobj)
|
Data['wpsite'] = WPobj
|
||||||
wstagingDelete.delete()
|
|
||||||
|
|
||||||
except BaseException as msg:
|
try:
|
||||||
da= str(msg)
|
DeleteID = request.GET.get('DeleteID', None)
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
|
if DeleteID != None:
|
||||||
Data, 'createWebsite')
|
wstagingDelete = WPStaging.objects.get(pk=DeleteID, owner=WPobj)
|
||||||
return proc.render()
|
wstagingDelete.delete()
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
da= str(msg)
|
||||||
|
|
||||||
|
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
|
||||||
|
Data, 'createWebsite')
|
||||||
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def RestoreHome(self, request=None, userID=None, BackupID=None ):
|
def RestoreHome(self, request=None, userID=None, BackupID=None ):
|
||||||
Data = {}
|
Data = {}
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
Data['backupobj'] = WPSitesBackup.objects.get(pk=BackupID)
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
|
|
||||||
config = json.loads(Data['backupobj'].config)
|
Data['backupobj'] = WPSitesBackup.objects.get(pk=BackupID)
|
||||||
Data['FileName']= config['name']
|
|
||||||
try:
|
config = json.loads(Data['backupobj'].config)
|
||||||
Data['Backuptype']= config['Backuptype']
|
Data['FileName']= config['name']
|
||||||
except:
|
try:
|
||||||
Data['Backuptype'] = None
|
Data['Backuptype']= config['Backuptype']
|
||||||
Data['WPsites'] = ACLManager.GetALLWPObjects(currentACL, userID)
|
except:
|
||||||
proc = httpProc(request, 'websiteFunctions/WPRestoreHome.html',
|
Data['Backuptype'] = None
|
||||||
Data, 'createWebsite')
|
Data['WPsites'] = ACLManager.GetALLWPObjects(currentACL, userID)
|
||||||
return proc.render()
|
proc = httpProc(request, 'websiteFunctions/WPRestoreHome.html',
|
||||||
|
Data, 'createWebsite')
|
||||||
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def RestoreBackups(self, request=None, userID=None, DeleteID=None):
|
def RestoreBackups(self, request=None, userID=None, DeleteID=None):
|
||||||
Data = {}
|
Data = {}
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
backobj = WPSitesBackup.objects.filter(owner=admin).order_by('-id')
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
import requests
|
||||||
if DeleteID != None:
|
response = requests.post(url, data=json.dumps(data))
|
||||||
DeleteIDobj = WPSitesBackup.objects.get(pk=DeleteID, owner=admin)
|
Status = response.json()['status']
|
||||||
config = DeleteIDobj.config
|
|
||||||
conf = json.loads(config)
|
|
||||||
FileName = conf['name']
|
|
||||||
command = "rm -r /home/backup/%s.tar.gz"%FileName
|
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
DeleteIDobj.delete()
|
|
||||||
|
|
||||||
except BaseException as msg:
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
pass
|
|
||||||
Data['job'] = []
|
|
||||||
|
|
||||||
for sub in backobj:
|
backobj = WPSitesBackup.objects.filter(owner=admin).order_by('-id')
|
||||||
try:
|
|
||||||
wpsite = WPSites.objects.get(pk=sub.WPSiteID)
|
|
||||||
web = wpsite.title
|
|
||||||
except:
|
|
||||||
web = "Website Not Found"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config = sub.config
|
if DeleteID != None:
|
||||||
conf = json.loads(config)
|
DeleteIDobj = WPSitesBackup.objects.get(pk=DeleteID, owner=admin)
|
||||||
Backuptype = conf['Backuptype']
|
config = DeleteIDobj.config
|
||||||
except:
|
conf = json.loads(config)
|
||||||
Backuptype = "Backup type not exists"
|
FileName = conf['name']
|
||||||
|
command = "rm -r /home/backup/%s.tar.gz"%FileName
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
DeleteIDobj.delete()
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
pass
|
||||||
|
Data['job'] = []
|
||||||
|
|
||||||
|
for sub in backobj:
|
||||||
|
try:
|
||||||
|
wpsite = WPSites.objects.get(pk=sub.WPSiteID)
|
||||||
|
web = wpsite.title
|
||||||
|
except:
|
||||||
|
web = "Website Not Found"
|
||||||
|
|
||||||
|
try:
|
||||||
|
config = sub.config
|
||||||
|
conf = json.loads(config)
|
||||||
|
Backuptype = conf['Backuptype']
|
||||||
|
except:
|
||||||
|
Backuptype = "Backup type not exists"
|
||||||
|
|
||||||
|
|
||||||
Data['job'].append({
|
Data['job'].append({
|
||||||
'id': sub.id,
|
'id': sub.id,
|
||||||
'title': web,
|
'title': web,
|
||||||
'Backuptype': Backuptype
|
'Backuptype': Backuptype
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
proc = httpProc(request, 'websiteFunctions/RestoreBackups.html',
|
||||||
|
Data, 'createWebsite')
|
||||||
|
return proc.render()
|
||||||
proc = httpProc(request, 'websiteFunctions/RestoreBackups.html',
|
else:
|
||||||
Data, 'createWebsite')
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
return proc.render()
|
|
||||||
|
|
||||||
def AutoLogin(self, request=None, userID=None):
|
def AutoLogin(self, request=None, userID=None):
|
||||||
|
|
||||||
@@ -225,76 +265,99 @@ class WebsiteManager:
|
|||||||
#php = VirtualHost.getPHPString(self.data['PHPVersion'])
|
#php = VirtualHost.getPHPString(self.data['PHPVersion'])
|
||||||
#FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
#FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
## Get title
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
password = randomPassword.generate_pass(10)
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
command = 'sudo -u %s wp user create autologin %s --role=administrator --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path)
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
|
|
||||||
command = 'sudo -u %s wp user update autologin --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, password, WPobj.path)
|
## Get title
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
|
|
||||||
data = {}
|
password = randomPassword.generate_pass(10)
|
||||||
|
|
||||||
if WPobj.FinalURL.endswith('/'):
|
command = 'sudo -u %s wp user create autologin %s --role=administrator --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path)
|
||||||
FinalURL = WPobj.FinalURL[:-1]
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
command = 'sudo -u %s wp user update autologin --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, password, WPobj.path)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
|
||||||
|
if WPobj.FinalURL.endswith('/'):
|
||||||
|
FinalURL = WPobj.FinalURL[:-1]
|
||||||
|
else:
|
||||||
|
FinalURL = WPobj.FinalURL
|
||||||
|
|
||||||
|
data['url'] = 'https://%s' % (FinalURL)
|
||||||
|
data['userName'] = 'autologin'
|
||||||
|
data['password'] = password
|
||||||
|
|
||||||
|
proc = httpProc(request, 'websiteFunctions/AutoLogin.html',
|
||||||
|
data, 'createWebsite')
|
||||||
|
return proc.render()
|
||||||
else:
|
else:
|
||||||
FinalURL = WPobj.FinalURL
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
data['url'] = 'https://%s' % (FinalURL)
|
|
||||||
data['userName'] = 'autologin'
|
|
||||||
data['password'] = password
|
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/AutoLogin.html',
|
|
||||||
data, 'createWebsite')
|
|
||||||
return proc.render()
|
|
||||||
|
|
||||||
def ConfigurePlugins(self, request=None, userID=None, data=None):
|
def ConfigurePlugins(self, request=None, userID=None, data=None):
|
||||||
|
|
||||||
DataPass ={}
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
userobj = Administrator.objects.get(pk=userID)
|
userobj = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
|
||||||
Selectedplugins = wpplugins.objects.filter(owner = userobj)
|
Selectedplugins = wpplugins.objects.filter(owner = userobj)
|
||||||
#data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
|
#data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
|
||||||
|
|
||||||
Data = {'Selectedplugins' : Selectedplugins,}
|
Data = {'Selectedplugins' : Selectedplugins,}
|
||||||
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
|
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def Addnewplugin(self, request=None, userID=None, data=None):
|
def Addnewplugin(self, request=None, userID=None, data=None):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
phps = PHPManager.findPHPVersions()
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
|
phps = PHPManager.findPHPVersions()
|
||||||
|
|
||||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
||||||
proc = httpProc(request, 'websiteFunctions/WPAddNewPlugin.html',
|
proc = httpProc(request, 'websiteFunctions/WPAddNewPlugin.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def SearchOnkeyupPlugin(self, userID=None, data=None):
|
def SearchOnkeyupPlugin(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
pluginname = data['pluginname']
|
pluginname = data['pluginname']
|
||||||
# logging.CyberCPLogFileWriter.writeToFile("Plugin Name ....... %s"%pluginname)
|
# logging.CyberCPLogFileWriter.writeToFile("Plugin Name ....... %s"%pluginname)
|
||||||
|
|
||||||
url = "http://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[search]=%s" % str(pluginname)
|
url = "http://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[search]=%s" % str(pluginname)
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
res = requests.get(url)
|
res = requests.get(url)
|
||||||
r = res.json()
|
r = res.json()
|
||||||
|
|
||||||
# return proc.ajax(1, 'Done', {'plugins': r})
|
# return proc.ajax(1, 'Done', {'plugins': r})
|
||||||
|
|
||||||
data_ret = {'status': 1,'plugns': r,}
|
data_ret = {'status': 1,'plugns': r,}
|
||||||
|
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
else:
|
||||||
|
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': 'Premium feature not available.'}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': str(msg)}
|
||||||
@@ -715,7 +778,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def DeploytoProduction(self, userID=None, data=None):
|
def DeploytoProduction(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -762,7 +824,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def WPCreateBackup(self, userID=None, data=None):
|
def WPCreateBackup(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -802,7 +863,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def RestoreWPbackupNow(self, userID=None, data=None):
|
def RestoreWPbackupNow(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -812,6 +872,7 @@ class WebsiteManager:
|
|||||||
backupid = data['backupid']
|
backupid = data['backupid']
|
||||||
DesSiteID = data['DesSite']
|
DesSiteID = data['DesSite']
|
||||||
|
|
||||||
|
|
||||||
Domain = data['Domain']
|
Domain = data['Domain']
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user