mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 07:16:15 +01:00
wordpresscreateandinstalldone
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
#!/usr/local/CyberCP/bin/python
|
#!/usr/local/CyberCP/bin/python
|
||||||
import argparse
|
import argparse
|
||||||
import os, sys
|
import os, sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
from loginSystem.models import Administrator
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
|
||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
import django
|
import django
|
||||||
|
|
||||||
@@ -11,8 +14,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
|||||||
django.setup()
|
django.setup()
|
||||||
import threading as multi
|
import threading as multi
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
import subprocess
|
import subprocess
|
||||||
from websiteFunctions.models import ChildDomains, Websites
|
from websiteFunctions.models import ChildDomains, Websites, WPSites
|
||||||
from plogical import randomPassword
|
from plogical import randomPassword
|
||||||
from plogical.mysqlUtilities import mysqlUtilities
|
from plogical.mysqlUtilities import mysqlUtilities
|
||||||
from databases.models import Databases
|
from databases.models import Databases
|
||||||
@@ -33,11 +37,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
multi.Thread.__init__(self)
|
multi.Thread.__init__(self)
|
||||||
self.installApp = installApp
|
self.installApp = installApp
|
||||||
self.extraArgs = extraArgs
|
self.extraArgs = extraArgs
|
||||||
|
|
||||||
if extraArgs != None:
|
if extraArgs != None:
|
||||||
try:
|
try:
|
||||||
self.tempStatusPath = self.extraArgs['tempStatusPath']
|
self.tempStatusPath = self.extraArgs['tempStatusPath']
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
self.data = self.extraArgs
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
@@ -56,6 +62,8 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
self.updatePackage()
|
self.updatePackage()
|
||||||
elif self.installApp == 'mautic':
|
elif self.installApp == 'mautic':
|
||||||
self.installMautic()
|
self.installMautic()
|
||||||
|
elif self.installApp == 'wordpressInstallNew':
|
||||||
|
self.wordpressInstallNew()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]')
|
logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]')
|
||||||
@@ -473,7 +481,6 @@ $parameters = array(
|
|||||||
|
|
||||||
def installWordPress(self):
|
def installWordPress(self):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
domainName = self.extraArgs['domainName']
|
domainName = self.extraArgs['domainName']
|
||||||
home = self.extraArgs['home']
|
home = self.extraArgs['home']
|
||||||
tempStatusPath = self.extraArgs['tempStatusPath']
|
tempStatusPath = self.extraArgs['tempStatusPath']
|
||||||
@@ -1622,6 +1629,103 @@ $parameters = array(
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def wordpressInstallNew(self):
|
||||||
|
try:
|
||||||
|
from websiteFunctions.website import WebsiteManager
|
||||||
|
import json
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile("start wordpressInstallNew...." )
|
||||||
|
tempStatusPath = self.data['tempStatusPath']
|
||||||
|
statusFile = open(tempStatusPath, 'w')
|
||||||
|
statusFile.writelines('Creating Website...')
|
||||||
|
statusFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
DataToPass = {}
|
||||||
|
|
||||||
|
currentTemp = self.extraArgs['tempStatusPath']
|
||||||
|
DataToPass['domainName'] = self.data['domainName']
|
||||||
|
DataToPass['adminEmail'] = self.data['adminEmail']
|
||||||
|
DataToPass['phpSelection'] = "PHP 7.4"
|
||||||
|
DataToPass['websiteOwner'] = self.data['websiteOwner']
|
||||||
|
DataToPass['package'] = self.data['package']
|
||||||
|
DataToPass['ssl'] = 1
|
||||||
|
DataToPass['dkimCheck'] = 0
|
||||||
|
DataToPass['openBasedir'] = 0
|
||||||
|
DataToPass['mailDomain'] = 0
|
||||||
|
UserID = self.data['adminID']
|
||||||
|
|
||||||
|
ab = WebsiteManager()
|
||||||
|
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
|
||||||
|
coreResult1 = json.loads((coreResult).content)
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile("Creating website result....%s"%coreResult1)
|
||||||
|
reutrntempath = coreResult1['tempStatusPath']
|
||||||
|
while (1):
|
||||||
|
lastLine = open(reutrntempath, 'r').read()
|
||||||
|
|
||||||
|
if lastLine.find('[200]') > -1:
|
||||||
|
break
|
||||||
|
elif lastLine.find('[404]') > -1:
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('Failed to Create Website: error: %s[404]' % lastLine)
|
||||||
|
statusFile.close()
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('Creating Website....,20')
|
||||||
|
statusFile.close()
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
statusFile = open(tempStatusPath, 'w')
|
||||||
|
statusFile.writelines('Installing WordPress....')
|
||||||
|
statusFile.close()
|
||||||
|
|
||||||
|
## Install WordPress
|
||||||
|
|
||||||
|
|
||||||
|
currentTemp = self.extraArgs['tempStatusPath']
|
||||||
|
self.extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
|
self.installWordPress()
|
||||||
|
|
||||||
|
while (1):
|
||||||
|
lastLine = open(self.extraArgs['tempStatusPath'], 'r').read()
|
||||||
|
|
||||||
|
if lastLine.find('[200]') > -1:
|
||||||
|
break
|
||||||
|
elif lastLine.find('[404]') > -1:
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('Failed to install WordPress: error: %s[404]' % lastLine)
|
||||||
|
statusFile.close()
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('Installing WordPress....,30')
|
||||||
|
statusFile.close()
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('WordPress installed..,70')
|
||||||
|
statusFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
webobj = Websites.objects.get(domain= self.extraArgs['domainName'])
|
||||||
|
|
||||||
|
path ="/home/%s/public_html"%(self.extraArgs['domainName'])
|
||||||
|
Finalurl = (self.extraArgs['domainName'])
|
||||||
|
|
||||||
|
wpobj = WPSites(owner=webobj, title=self.extraArgs['blogTitle'], path=path, FinalURL=Finalurl,
|
||||||
|
AutoUpdates=(self.extraArgs['updates']), PluginUpdates=(self.extraArgs['Plugins']),
|
||||||
|
ThemeUpdates=(self.extraArgs['Themes']),)
|
||||||
|
wpobj.save()
|
||||||
|
|
||||||
|
statusFile = open(currentTemp, 'w')
|
||||||
|
statusFile.writelines('WordPress installed..,[200]')
|
||||||
|
statusFile.close()
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile("Error WP web creating ....... %s" % str(msg))
|
||||||
|
return 0
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
|
||||||
parser.add_argument('function', help='Specify a function to call!')
|
parser.add_argument('function', help='Specify a function to call!')
|
||||||
|
|||||||
@@ -244,6 +244,183 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.controller('createWordpress', function ($scope, $http, $timeout, $window) {
|
||||||
|
$scope.webSiteCreationLoading = true;
|
||||||
|
$scope.installationDetailsForm = false;
|
||||||
|
$scope.installationProgress = true;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = true;
|
||||||
|
|
||||||
|
var statusFile;
|
||||||
|
|
||||||
|
$scope.createWordPresssite = function () {
|
||||||
|
|
||||||
|
$scope.webSiteCreationLoading = false;
|
||||||
|
$scope.installationDetailsForm = true;
|
||||||
|
$scope.installationProgress = false;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = true;
|
||||||
|
|
||||||
|
|
||||||
|
$scope.currentStatus = "Starting creation..";
|
||||||
|
|
||||||
|
var package = $scope.packageForWebsite;
|
||||||
|
var websiteOwner = $scope.websiteOwner;
|
||||||
|
var WPtitle = $scope.WPtitle;
|
||||||
|
var domainNameCreate = $scope.domainNameCreate;
|
||||||
|
var WPUsername = $scope.WPUsername;
|
||||||
|
var adminEmail = $scope.adminEmail;
|
||||||
|
var WPPassword = $scope.WPPassword;
|
||||||
|
var WPVersions = $scope.WPVersions;
|
||||||
|
var pluginbucket = $scope.pluginbucket;
|
||||||
|
var autoupdates = $scope.autoupdates;
|
||||||
|
var pluginupdates = $scope.pluginupdates;
|
||||||
|
var themeupdates = $scope.themeupdates;
|
||||||
|
var data = {
|
||||||
|
|
||||||
|
title: WPtitle,
|
||||||
|
domain: domainNameCreate,
|
||||||
|
WPVersion: WPVersions,
|
||||||
|
PluginsThemes: pluginbucket,
|
||||||
|
adminUser: WPUsername,
|
||||||
|
Email: adminEmail,
|
||||||
|
PasswordByPass: WPPassword,
|
||||||
|
AutomaticUpdates: autoupdates,
|
||||||
|
Plugins: pluginupdates,
|
||||||
|
Themes: themeupdates,
|
||||||
|
websiteOwner: websiteOwner,
|
||||||
|
package: package,
|
||||||
|
}
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var url = "/websites/submitWorpressCreation";
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
statusFile = response.data.tempStatusPath;
|
||||||
|
getCreationStatus();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// $scope.errorMessage = response.data.error_message;
|
||||||
|
alert("Status not = 1: Error..." + response.data.error_message)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
alert("Error..." + response)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
$scope.goBack = function () {
|
||||||
|
$scope.webSiteCreationLoading = true;
|
||||||
|
$scope.installationDetailsForm = false;
|
||||||
|
$scope.installationProgress = true;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = true;
|
||||||
|
$("#installProgress").css("width", "0%");
|
||||||
|
};
|
||||||
|
function getCreationStatus() {
|
||||||
|
|
||||||
|
url = "/websites/installWordpressStatus";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
statusFile: statusFile
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if (response.data.abort === 1) {
|
||||||
|
|
||||||
|
if (response.data.installStatus === 1) {
|
||||||
|
|
||||||
|
$scope.webSiteCreationLoading = true;
|
||||||
|
$scope.installationDetailsForm = true;
|
||||||
|
$scope.installationProgress = false;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = false;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = false;
|
||||||
|
|
||||||
|
$("#installProgress").css("width", "100%");
|
||||||
|
$scope.installPercentage = "100";
|
||||||
|
$scope.currentStatus = response.data.currentStatus;
|
||||||
|
$timeout.cancel();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$scope.webSiteCreationLoading = true;
|
||||||
|
$scope.installationDetailsForm = true;
|
||||||
|
$scope.installationProgress = false;
|
||||||
|
$scope.errorMessageBox = false;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = false;
|
||||||
|
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
$("#installProgress").css("width", "0%");
|
||||||
|
$scope.installPercentage = "0";
|
||||||
|
$scope.goBackDisable = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$("#installProgress").css("width", response.data.installationProgress + "%");
|
||||||
|
$scope.installPercentage = response.data.installationProgress;
|
||||||
|
$scope.currentStatus = response.data.currentStatus;
|
||||||
|
$timeout(getCreationStatus, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
|
||||||
|
$scope.webSiteCreationLoading = true;
|
||||||
|
$scope.installationDetailsForm = true;
|
||||||
|
$scope.installationProgress = false;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = false;
|
||||||
|
$scope.goBackDisable = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/* Java script code to create account */
|
/* Java script code to create account */
|
||||||
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
|
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
|
||||||
|
|
||||||
|
|||||||
@@ -47,14 +47,14 @@
|
|||||||
<td class="v-align-middle">
|
<td class="v-align-middle">
|
||||||
<p>{{ sub.Name }}</p>
|
<p>{{ sub.Name }}</p>
|
||||||
</td>
|
</td>
|
||||||
<td class="row form-group">
|
<td class="row">
|
||||||
<div class="col">
|
<div class="col-md-2">
|
||||||
<a href="{% url 'EidtPlugin'%}?ID={{sub.id}}"
|
<a href="{% url 'EidtPlugin'%}?ID={{sub.id}}"
|
||||||
type="button" class="btn btn-border btn-alt border-green btn-link font-green">
|
type="button" class="btn btn-border btn-alt border-green btn-link font-green">
|
||||||
Edit
|
Edit
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col-md-2">
|
||||||
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div ng-controller="createWebsite" class="panel">
|
<div ng-controller="createWordpress" class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h3 class="content-box-header">
|
<h3 class="content-box-header">
|
||||||
{% trans "Website Details" %} <img ng-hide="webSiteCreationLoading"
|
{% trans "Website Details" %} <img ng-hide="webSiteCreationLoading"
|
||||||
@@ -95,14 +95,66 @@
|
|||||||
<div ng-hide="installationDetailsForm" class="form-group">
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Select WP Version" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Select WP Version" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select ng-model="phpSelection" class="form-control">
|
<select ng-model="WPVersions" class="form-control">
|
||||||
{% for php in WPVersions %}
|
{% for wp in WPVersions %}
|
||||||
<option>{{ php }}</option>
|
<option>{{ wp }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<option value="-1" selected>Select Plugin Bucket</option>
|
||||||
|
{% for wp in Plugins %}
|
||||||
|
<option value="{{ wp.id }}">{{ wp.Name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Automatic Updates" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select ng-model="autoupdates" class="form-control">
|
||||||
|
|
||||||
|
<option>Disabled</option>
|
||||||
|
<option>All (minor and major)</option>
|
||||||
|
<option>Minor and Security Updates</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Plugins Updates" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select ng-model="pluginupdates" class="form-control">
|
||||||
|
|
||||||
|
<option>Enabled</option>
|
||||||
|
<option>Disabled</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Themes Updates" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select ng-model="themeupdates" class="form-control">
|
||||||
|
|
||||||
|
<option>Enabled</option>
|
||||||
|
<option>Disabled</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div ng-hide="installationDetailsForm" class="form-group">
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
@@ -145,8 +197,7 @@
|
|||||||
<div ng-hide="installationDetailsForm" class="form-group">
|
<div ng-hide="installationDetailsForm" class="form-group">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<label class="col-sm-3 control-label"></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
|
<button type="button" ng-click="createWordPresssite()"
|
||||||
type="button" ng-click="createWebsite()"
|
|
||||||
class="btn btn-primary btn-lg">{% trans "Create Website" %}</button>
|
class="btn btn-primary btn-lg">{% trans "Create Website" %}</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ urlpatterns = [
|
|||||||
### WordPress
|
### WordPress
|
||||||
url(r'^createWordpress$', views.WPCreate, name='createWordpress'),
|
url(r'^createWordpress$', views.WPCreate, name='createWordpress'),
|
||||||
|
|
||||||
|
###WordPress Ajax
|
||||||
|
url(r'^submitWorpressCreation', views.submitWorpressCreation, name='submitWorpressCreation'),
|
||||||
|
|
||||||
#### AddPlugin
|
#### AddPlugin
|
||||||
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
|
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
|
||||||
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
|
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
|
||||||
|
|||||||
@@ -161,6 +161,28 @@ def Addplugineidt(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
def submitWorpressCreation(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
|
||||||
|
result = pluginManager.preWebsiteCreation(request)
|
||||||
|
|
||||||
|
if result != 200:
|
||||||
|
return result
|
||||||
|
|
||||||
|
wm = WebsiteManager()
|
||||||
|
coreResult = wm.submitWorpressCreation(userID, json.loads(request.body))
|
||||||
|
|
||||||
|
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||||
|
if result != 200:
|
||||||
|
return result
|
||||||
|
|
||||||
|
return coreResult
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def modifyWebsite(request):
|
def modifyWebsite(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class WebsiteManager:
|
|||||||
phps = PHPManager.findPHPVersions()
|
phps = PHPManager.findPHPVersions()
|
||||||
FinalVersions = []
|
FinalVersions = []
|
||||||
#logging.CyberCPLogFileWriter.writeToFile("jassssssssss...............")
|
#logging.CyberCPLogFileWriter.writeToFile("jassssssssss...............")
|
||||||
|
userobj = Administrator.objects.get(pk=userID)
|
||||||
counter = 0
|
counter = 0
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
@@ -81,9 +81,11 @@ class WebsiteManager:
|
|||||||
except:
|
except:
|
||||||
FinalVersions = ['5.6', '5.5.3', '5.5.2']
|
FinalVersions = ['5.6', '5.5.3', '5.5.2']
|
||||||
|
|
||||||
|
Plugins = wpplugins.objects.filter(owner=userobj)
|
||||||
|
|
||||||
# logging.CyberCPLogFileWriter.writeToFile("FinalVersions:%s"+str(FinalVersions))
|
# logging.CyberCPLogFileWriter.writeToFile("FinalVersions:%s"+str(FinalVersions))
|
||||||
|
|
||||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'WPVersions': FinalVersions}
|
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins }
|
||||||
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
@@ -340,6 +342,47 @@ class WebsiteManager:
|
|||||||
})
|
})
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
|
def submitWorpressCreation(self, userID=None, data=None):
|
||||||
|
try:
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
extraArgs = {}
|
||||||
|
extraArgs['adminID'] = admin.pk
|
||||||
|
extraArgs['domainName'] = data['domain']
|
||||||
|
extraArgs['WPVersion'] = data['WPVersion']
|
||||||
|
extraArgs['blogTitle'] = data['title']
|
||||||
|
extraArgs['PluginsThemes'] = data['PluginsThemes']
|
||||||
|
extraArgs['adminUser'] = data['adminUser']
|
||||||
|
extraArgs['PasswordByPass'] = data['PasswordByPass']
|
||||||
|
extraArgs['adminPassword'] = data['PasswordByPass']
|
||||||
|
extraArgs['adminEmail'] = data['Email']
|
||||||
|
extraArgs['updates'] = data['AutomaticUpdates']
|
||||||
|
extraArgs['Plugins'] = data['Plugins']
|
||||||
|
extraArgs['Themes'] = data['Themes']
|
||||||
|
extraArgs['websiteOwner'] = data['websiteOwner']
|
||||||
|
extraArgs['package'] = data['package']
|
||||||
|
extraArgs['home'] = "1"
|
||||||
|
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
|
|
||||||
|
|
||||||
|
background = ApplicationInstaller('wordpressInstallNew', extraArgs)
|
||||||
|
background.start()
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',
|
||||||
|
'tempStatusPath': extraArgs['tempStatusPath']}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def submitWebsiteCreation(self, userID=None, data=None):
|
def submitWebsiteCreation(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -2508,11 +2551,11 @@ StrictHostKeyChecking no
|
|||||||
adminEmail = data['ownerEmail']
|
adminEmail = data['ownerEmail']
|
||||||
websiteOwner = data['websiteOwner']
|
websiteOwner = data['websiteOwner']
|
||||||
ownerPassword = data['ownerPassword']
|
ownerPassword = data['ownerPassword']
|
||||||
data['ssl'] = 0
|
data['ssl'] = 1
|
||||||
data['dkimCheck'] = 0
|
data['dkimCheck'] = 0
|
||||||
data['openBasedir'] = 1
|
data['openBasedir'] = 1
|
||||||
data['adminEmail'] = data['ownerEmail']
|
data['adminEmail'] = data['ownerEmail']
|
||||||
data['phpSelection'] = "PHP 7.0"
|
data['phpSelection'] = "PHP 7.4"
|
||||||
data['package'] = data['packageName']
|
data['package'] = data['packageName']
|
||||||
try:
|
try:
|
||||||
websitesLimit = data['websitesLimit']
|
websitesLimit = data['websitesLimit']
|
||||||
|
|||||||
Reference in New Issue
Block a user