mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
wpdone
This commit is contained in:
@@ -395,18 +395,18 @@
|
||||
<li>
|
||||
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'WordPress' %}">
|
||||
<div class="glyph-icon icon-wordpress" title="{% trans 'WordPress' %}"></div>
|
||||
<span>{% trans "Wordpresss" %}</span>
|
||||
<span>{% trans "WordPresss" %}</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
{% if admin or createWebsite %}
|
||||
<li><a href="{% url 'createWordpress' %}"
|
||||
title="{% trans 'Create Worpress' %}"><span>{% trans "Create Worpress" %}</span></a>
|
||||
title="{% trans 'Deploy WordPress' %}"><span>{% trans "Deploy WordPress" %}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'ListWPSites' %}"
|
||||
title="{% trans 'List Websites' %}"><span>{% trans "List Worpress" %}</span></a>
|
||||
title="{% trans 'List WordPress' %}"><span>{% trans "List WordPress" %}</span></a>
|
||||
</li>
|
||||
<li><a href="{% url 'ConfigurePlugins' %}"
|
||||
title="{% trans 'ConfigurePlugins' %}"><span>{% trans "Configure Plugins" %}</span></a>
|
||||
|
||||
@@ -15,7 +15,7 @@ django.setup()
|
||||
import threading as multi
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import subprocess
|
||||
from websiteFunctions.models import ChildDomains, Websites, WPSites, WPStaging
|
||||
from websiteFunctions.models import ChildDomains, Websites, WPSites, WPStaging, wpplugins
|
||||
from plogical import randomPassword
|
||||
from plogical.mysqlUtilities import mysqlUtilities
|
||||
from databases.models import Databases
|
||||
@@ -729,6 +729,31 @@ $parameters = array(
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
############## Install Save Plugin Buckets
|
||||
try:
|
||||
logging.writeToFile("plugin bucket list start")
|
||||
logging.writeToFile("plugin bucket list: %s" % str(self.extraArgs['AllPluginsList']))
|
||||
logging.writeToFile("plugin bucket saved: %s" % str(self.extraArgs['SavedPlugins']))
|
||||
if self.extraArgs['SavedPlugins'] == True:
|
||||
AllPluginList= self.extraArgs['AllPluginsList']
|
||||
for i in range(len(AllPluginList)):
|
||||
# command = "wp plugin install " + AllPluginList[i]+ "--allow-root --path=" + finalPath
|
||||
command = "wp plugin install %s --allow-root --path=%s" %(AllPluginList[i], finalPath)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
command = "wp plugin activate %s --allow-root --path=%s" %(AllPluginList[i], finalPath)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
except BaseException as msg:
|
||||
logging.writeToFile("Error in istall plugin bucket: %s"%str(msg))
|
||||
pass
|
||||
|
||||
|
||||
|
||||
##
|
||||
|
||||
# from filemanager.filemanager import FileManager
|
||||
@@ -1689,11 +1714,33 @@ $parameters = array(
|
||||
statusFile.writelines('Installing WordPress....,30')
|
||||
statusFile.close()
|
||||
|
||||
## Install WordPress
|
||||
logging.writeToFile("Pluginbucket ....... %s" % str(self.data['pluginbucket']))
|
||||
|
||||
|
||||
## Install WordPress
|
||||
## get save pluginbucket
|
||||
|
||||
###Get save plugin
|
||||
SavedPlugins = False
|
||||
AllPluginsList = []
|
||||
try:
|
||||
if(self.data['pluginbucket'] != 1):
|
||||
bucktobj = wpplugins.objects.get(pk=self.data['pluginbucket'])
|
||||
pluginlistt = json.loads(bucktobj.config)
|
||||
SavedPlugins = True
|
||||
for i in range(len(pluginlistt)):
|
||||
AllPluginsList.append(pluginlistt[i])
|
||||
except BaseException as msg:
|
||||
logging.writeToFile("Error in Get save plugin ....... %s" % str(msg))
|
||||
pass
|
||||
|
||||
logging.writeToFile("AllPluginsList 1 ....... %s" % str(AllPluginsList))
|
||||
logging.writeToFile("SavedPlugins 1 ....... %s" % str(SavedPlugins))
|
||||
|
||||
currentTemp = self.extraArgs['tempStatusPath']
|
||||
self.extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
self.extraArgs['SavedPlugins'] = SavedPlugins
|
||||
self.extraArgs['AllPluginsList'] = AllPluginsList
|
||||
self.installWordPress()
|
||||
|
||||
while (1):
|
||||
|
||||
@@ -275,7 +275,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
|
||||
var adminEmail = $scope.adminEmail;
|
||||
var WPPassword = $scope.WPPassword;
|
||||
var WPVersions = $scope.WPVersions;
|
||||
var pluginbucket = $scope.pluginbucket;
|
||||
var pluginbucket = $('#pliginbucket').val();
|
||||
var autoupdates = $scope.autoupdates;
|
||||
var pluginupdates = $scope.pluginupdates;
|
||||
var themeupdates = $scope.themeupdates;
|
||||
@@ -284,7 +284,7 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
|
||||
title: WPtitle,
|
||||
domain: domainNameCreate,
|
||||
WPVersion: WPVersions,
|
||||
PluginsThemes: pluginbucket,
|
||||
pluginbucket: pluginbucket,
|
||||
adminUser: WPUsername,
|
||||
Email: adminEmail,
|
||||
PasswordByPass: WPPassword,
|
||||
@@ -423,6 +423,15 @@ app.controller('createWordpress', function ($scope, $http, $timeout, $compile, $
|
||||
});
|
||||
|
||||
|
||||
|
||||
//........... delete wp list
|
||||
var FurlDeleteWP;
|
||||
function DeleteWPNow(url) {
|
||||
FurlDeleteWP = url;
|
||||
}
|
||||
function FinalDeleteWPNow() {
|
||||
window.location.href = FurlDeleteWP;
|
||||
}
|
||||
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
|
||||
$scope.wordpresshomeloading = true;
|
||||
$scope.stagingDetailsForm = false;
|
||||
@@ -482,7 +491,11 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
}
|
||||
|
||||
} else {
|
||||
alert("Error:" + response.data.error_message)
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Plugin/Theme" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="pluginbucket" class="form-control">
|
||||
<select id="pliginbucket" ng-model="pluginbucket" class="form-control">
|
||||
<option value="-1" selected>Select Plugin Bucket</option>
|
||||
{% for wp in Plugins %}
|
||||
<option value="{{ wp.id }}">{{ wp.Name }}</option>
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
<div ng-controller="WPAddNewPlugin" class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h2>{{ BucketName }}</h2>
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
|
||||
|
||||
<label style="margin-bottom: 10px;">{% trans "Search Plugin Name" %}</label>
|
||||
|
||||
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
|
||||
@@ -39,11 +42,13 @@
|
||||
{% for plugin in Selectedplugins %}
|
||||
<div id="selplug"
|
||||
style="background-color: #12207a; color: #FFFFFF; padding: 5px; border-radius: 30px">
|
||||
{{plugin}}
|
||||
<svg ng-click="deletesPlgin('{{plugin}}')" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
|
||||
{{ plugin }}
|
||||
<svg ng-click="deletesPlgin('{{ plugin }}')" xmlns="http://www.w3.org/2000/svg"
|
||||
aria-hidden="true"
|
||||
role="img" width="1em" height="1em"
|
||||
preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.5" d="m11.25 4.75l-6.5 6.5m0-6.5l6.5 6.5"/>
|
||||
</svg>
|
||||
|
||||
@@ -54,16 +59,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
|
||||
type="button" ng-click="AddNewplugin()"
|
||||
class="btn btn-primary btn-lg">{% trans "Add Plugin Bucket" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -127,15 +127,43 @@
|
||||
|
||||
<td style="padding: 13px;">
|
||||
|
||||
|
||||
|
||||
<button
|
||||
|
||||
data-toggle="modal"
|
||||
data-target="#DeleteMember" aria-label=""
|
||||
onclick="DeleteWPNow('{% url 'ListWPSites' %}?DeleteID={{ sub.id }}')"
|
||||
type="button" class="btn btn-border btn-alt border-red btn-link font-red">
|
||||
Delete
|
||||
</button>
|
||||
<div id="DeleteMember" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete WordPress Site
|
||||
<img ng-hide="$parent.cyberPanelLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
|
||||
|
||||
<span>Do you want to delete the site??</span>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
onclick="FinalDeleteWPNow()">Yes
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
NOt
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
@@ -40,8 +40,9 @@ def WPCreate(request):
|
||||
def ListWPSites(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
DeleteID = request.GET.get('DeleteID')
|
||||
wm = WebsiteManager()
|
||||
return wm.ListWPSites(request, userID)
|
||||
return wm.ListWPSites(request, userID, DeleteID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class WebsiteManager:
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
|
||||
def ListWPSites(self, request=None, userID=None, data=None):
|
||||
def ListWPSites(self, request=None, userID=None, DeleteID=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
@@ -101,6 +101,14 @@ class WebsiteManager:
|
||||
tata['wpsites']=[]
|
||||
tata['wp'] = WPSites.objects.all()
|
||||
|
||||
try:
|
||||
if DeleteID != None:
|
||||
WPDelete = WPSites.objects.get(pk=DeleteID)
|
||||
WPDelete.delete()
|
||||
|
||||
except BaseException as msg:
|
||||
pass
|
||||
|
||||
for sub in tata['wp']:
|
||||
tata['wpsites'].append({'id': sub.id,
|
||||
'title': sub.title,
|
||||
@@ -248,6 +256,7 @@ class WebsiteManager:
|
||||
lmo = json.loads(pluginobj.config)
|
||||
Data['Selectedplugins'] = lmo
|
||||
Data['pluginbID'] = pluginbID
|
||||
Data['BucketName'] = pluginobj.Name
|
||||
|
||||
|
||||
proc = httpProc(request, 'websiteFunctions/WPEidtPlugin.html',
|
||||
@@ -418,6 +427,7 @@ class WebsiteManager:
|
||||
wpsite = WPSites.objects.get(pk=WPManagerID)
|
||||
path = wpsite.path
|
||||
|
||||
|
||||
Webobj= Websites.objects.get(pk=wpsite.owner_id)
|
||||
|
||||
Vhuser = Webobj.externalApp
|
||||
@@ -1036,7 +1046,7 @@ class WebsiteManager:
|
||||
extraArgs['domainName'] = data['domain']
|
||||
extraArgs['WPVersion'] = data['WPVersion']
|
||||
extraArgs['blogTitle'] = data['title']
|
||||
extraArgs['PluginsThemes'] = data['PluginsThemes']
|
||||
extraArgs['pluginbucket'] = data['pluginbucket']
|
||||
extraArgs['adminUser'] = data['adminUser']
|
||||
extraArgs['PasswordByPass'] = data['PasswordByPass']
|
||||
extraArgs['adminPassword'] = data['PasswordByPass']
|
||||
|
||||
Reference in New Issue
Block a user