diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py
index a09d26c5c..297babb77 100755
--- a/plogical/applicationInstaller.py
+++ b/plogical/applicationInstaller.py
@@ -1,9 +1,12 @@
#!/usr/local/CyberCP/bin/python
import argparse
import os, sys
+import time
+from loginSystem.models import Administrator
from plogical.acl import ACLManager
+
sys.path.append('/usr/local/CyberCP')
import django
@@ -11,8 +14,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
django.setup()
import threading as multi
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
+import plogical.CyberCPLogFileWriter as logging
import subprocess
-from websiteFunctions.models import ChildDomains, Websites
+from websiteFunctions.models import ChildDomains, Websites, WPSites
from plogical import randomPassword
from plogical.mysqlUtilities import mysqlUtilities
from databases.models import Databases
@@ -33,11 +37,13 @@ class ApplicationInstaller(multi.Thread):
multi.Thread.__init__(self)
self.installApp = installApp
self.extraArgs = extraArgs
+
if extraArgs != None:
try:
self.tempStatusPath = self.extraArgs['tempStatusPath']
except:
pass
+ self.data = self.extraArgs
def run(self):
try:
@@ -56,6 +62,8 @@ class ApplicationInstaller(multi.Thread):
self.updatePackage()
elif self.installApp == 'mautic':
self.installMautic()
+ elif self.installApp == 'wordpressInstallNew':
+ self.wordpressInstallNew()
except BaseException as msg:
logging.writeToFile(str(msg) + ' [ApplicationInstaller.run]')
@@ -473,7 +481,6 @@ $parameters = array(
def installWordPress(self):
try:
-
domainName = self.extraArgs['domainName']
home = self.extraArgs['home']
tempStatusPath = self.extraArgs['tempStatusPath']
@@ -1622,6 +1629,103 @@ $parameters = array(
statusFile.close()
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():
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
parser.add_argument('function', help='Specify a function to call!')
diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
index bf4966f2e..12fadf451 100755
--- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js
+++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
@@ -93,7 +93,7 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
for (i = 0; i <= res.length; i++) {
//
var tml = '
';
- var temp = $compile(tml)($scope)
+ var temp = $compile(tml)($scope)
angular.element(document.getElementById('mysearch')).append(temp);
}
@@ -199,9 +199,9 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $co
}
$scope.Addplugin = function (slug) {
- $('#mysearch').hide()
+ $('#mysearch').hide()
- url = "/websites/Addplugineidt";
+ url = "/websites/Addplugineidt";
var data = {
@@ -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 */
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
diff --git a/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html b/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html
index 63e28be6a..48560847b 100644
--- a/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html
+++ b/websiteFunctions/templates/websiteFunctions/WPConfigurePlugins.html
@@ -47,14 +47,14 @@
{{ sub.Name }}