mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
test_installJoomla
This commit is contained in:
@@ -236,7 +236,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
if not os.path.exists(finalPath):
|
if not os.path.exists(finalPath):
|
||||||
command = 'sudo mkdir -p ' + finalPath
|
command = 'mkdir -p ' + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
## checking for directories/files
|
## checking for directories/files
|
||||||
@@ -250,7 +250,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.writelines('Downloading WordPress Core,30')
|
statusFile.writelines('Downloading WordPress Core,30')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp core download --allow-root --path=" + finalPath
|
command = "wp core download --allow-root --path=" + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -259,7 +259,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.writelines('Configuring the installation,40')
|
statusFile.writelines('Configuring the installation,40')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
|
command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
if home == '0':
|
if home == '0':
|
||||||
@@ -268,7 +268,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
else:
|
else:
|
||||||
finalURL = domainName
|
finalURL = domainName
|
||||||
|
|
||||||
command = 'sudo wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
command = 'wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -277,19 +277,19 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.writelines('Installing LSCache Plugin,80')
|
statusFile.writelines('Installing LSCache Plugin,80')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
command = "wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines('Activating LSCache Plugin,90')
|
statusFile.writelines('Activating LSCache Plugin,90')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
command = "wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
@@ -305,7 +305,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -715,7 +715,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
if not os.path.exists("staging.zip"):
|
if not os.path.exists("staging.zip"):
|
||||||
command = 'wget --no-check-certificate https://github.com/joomla/joomla-cms/archive/staging.zip -P ' + finalPath
|
command = 'wget --no-check-certificate https://github.com/joomla/joomla-cms/archive/staging.zip -P ' + finalPath
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.executioner(command, virtualHostUser)
|
||||||
else:
|
else:
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines("File already exists." + " [404]")
|
statusFile.writelines("File already exists." + " [404]")
|
||||||
@@ -723,12 +723,16 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = 'unzip ' + finalPath + 'staging.zip -d ' + finalPath
|
command = 'unzip ' + finalPath + 'staging.zip -d ' + finalPath
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.executioner(command, virtualHostUser)
|
||||||
|
|
||||||
os.remove(finalPath + 'staging.zip')
|
command = 'rm -f %s' % (finalPath + 'staging.zip')
|
||||||
|
ProcessUtilities.executioner(command, virtualHostUser)
|
||||||
|
|
||||||
command = 'cp -r ' + finalPath + 'joomla-cms-staging/. ' + finalPath
|
command = 'cp -r ' + finalPath + 'joomla-cms-staging/. ' + finalPath
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.executioner(command, virtualHostUser)
|
||||||
|
|
||||||
|
command = 'chown -R cyberpanel:cyberpanel %s' % (finalPath)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
shutil.rmtree(finalPath + "joomla-cms-staging")
|
shutil.rmtree(finalPath + "joomla-cms-staging")
|
||||||
os.rename(finalPath + "installation/configuration.php-dist", finalPath + "configuration.php")
|
os.rename(finalPath + "installation/configuration.php-dist", finalPath + "configuration.php")
|
||||||
@@ -791,7 +795,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
# Rename SQL db prefix
|
# Rename SQL db prefix
|
||||||
|
|
||||||
f1 = open(finalPath + 'installation/sql/mysql/joomla.sql', 'r')
|
f1 = open(finalPath + 'installation/sql/mysql/joomla.sql', 'r')
|
||||||
f2 = open('installation/sql/mysql/joomlaInstall.sql', 'w')
|
f2 = open(finalPath + 'installation/sql/mysql/joomlaInstall.sql', 'w')
|
||||||
for line in f1:
|
for line in f1:
|
||||||
f2.write(line.replace('#__', prefix))
|
f2.write(line.replace('#__', prefix))
|
||||||
f1.close()
|
f1.close()
|
||||||
@@ -813,12 +817,12 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
shutil.rmtree(finalPath + "installation")
|
shutil.rmtree(finalPath + "installation")
|
||||||
|
|
||||||
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
|
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
|
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeedSocket()
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines("Successfully Installed. [200]")
|
statusFile.writelines("Successfully Installed. [200]")
|
||||||
@@ -831,7 +835,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -169,6 +169,11 @@ class ProcessUtilities(multi.Thread):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def sendCommand(command, user=None):
|
def sendCommand(command, user=None):
|
||||||
try:
|
try:
|
||||||
|
# if user == None:
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# cmd = 'usermod -a -G %s %s' % ('cyberpanel', user)
|
||||||
|
# ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
ret = ProcessUtilities.setupUDSConnection()
|
ret = ProcessUtilities.setupUDSConnection()
|
||||||
|
|
||||||
@@ -181,26 +186,12 @@ class ProcessUtilities(multi.Thread):
|
|||||||
|
|
||||||
sock = ret[0]
|
sock = ret[0]
|
||||||
|
|
||||||
# SplittedCommand = command.split(' ')
|
|
||||||
# if SplittedCommand[0] == 'sudo':
|
|
||||||
# finalCommand = SplittedCommand[1:]
|
|
||||||
# else:
|
|
||||||
# finalCommand = SplittedCommand
|
|
||||||
#
|
|
||||||
# CommandArgs = finalCommand[1:]
|
|
||||||
#
|
|
||||||
# finalCommand = finalCommand[0]
|
|
||||||
#
|
|
||||||
# for items in CommandArgs:
|
|
||||||
# finalCommand = '%s %s' % (finalCommand, items)
|
|
||||||
|
|
||||||
|
|
||||||
if user == None:
|
if user == None:
|
||||||
#logging.writeToFile(ProcessUtilities.token + command)
|
#logging.writeToFile(ProcessUtilities.token + command)
|
||||||
sock.sendall(ProcessUtilities.token + command)
|
sock.sendall(ProcessUtilities.token + command)
|
||||||
else:
|
else:
|
||||||
command = '%s-u %s %s' % (ProcessUtilities.token, user, command)
|
command = '%s-u %s %s' % (ProcessUtilities.token, user, command)
|
||||||
#logging.writeToFile(command)
|
#logging.writeToFile(ProcessUtilities.token + command)
|
||||||
command = command.replace('sudo', '')
|
command = command.replace('sudo', '')
|
||||||
sock.sendall(command)
|
sock.sendall(command)
|
||||||
|
|
||||||
@@ -213,6 +204,13 @@ class ProcessUtilities(multi.Thread):
|
|||||||
data = data + currentData
|
data = data + currentData
|
||||||
|
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
|
# if user == None:
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# cmd = 'deluser %s cyberpanel' % (user)
|
||||||
|
# ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile(str(msg) + " [sendCommand]")
|
logging.writeToFile(str(msg) + " [sendCommand]")
|
||||||
@@ -231,10 +229,8 @@ class ProcessUtilities(multi.Thread):
|
|||||||
exitCode = int(exitCode.encode('hex'), 16)
|
exitCode = int(exitCode.encode('hex'), 16)
|
||||||
|
|
||||||
if exitCode == 0:
|
if exitCode == 0:
|
||||||
#logging.writeToFile("Command: " + command + ", resturn code: " + str(exitCode) + ".")
|
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
#logging.writeToFile("Command: " + command + ", resturn code: " + str(exitCode) + ".")
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
@@ -280,7 +276,6 @@ class ProcessUtilities(multi.Thread):
|
|||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile(str(msg) + " [popenExecutioner]")
|
logging.writeToFile(str(msg) + " [popenExecutioner]")
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def BuildCommand(path, functionName, parameters):
|
def BuildCommand(path, functionName, parameters):
|
||||||
execPath = "/usr/local/CyberCP/bin/python2 %s %s " % (path, functionName)
|
execPath = "/usr/local/CyberCP/bin/python2 %s %s " % (path, functionName)
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import django
|
|||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
django.setup()
|
django.setup()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
import argparse
|
import argparse
|
||||||
import installUtilities
|
import installUtilities
|
||||||
|
|||||||
@@ -1345,7 +1345,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
|||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
if (response.data.installStatus == 1) {
|
if (response.data.installStatus === 1) {
|
||||||
if (typeof path != 'undefined') {
|
if (typeof path != 'undefined') {
|
||||||
$scope.installationURL = "http://" + domain + "/" + path;
|
$scope.installationURL = "http://" + domain + "/" + path;
|
||||||
} else {
|
} else {
|
||||||
@@ -1432,7 +1432,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
|||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
if (response.data.installStatus == 1) {
|
if (response.data.installStatus === 1) {
|
||||||
if (typeof path != 'undefined') {
|
if (typeof path != 'undefined') {
|
||||||
$scope.installationURL = "http://" + domain + "/" + path;
|
$scope.installationURL = "http://" + domain + "/" + path;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase
|
||||||
from django.urls import reverse
|
|
||||||
import json
|
import json
|
||||||
from loginSystem.models import Administrator, ACL
|
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
import ftp
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
import urllib3
|
||||||
|
urllib3.disable_warnings()
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class TestWebsiteManagement(TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
## Verify login
|
## Verify login
|
||||||
|
|
||||||
data_ret = {'username': 'admin', 'password': 'hello122'}
|
data_ret = {'username': 'admin', 'password': '1234567'}
|
||||||
response = self.MakeRequest('verifyLogin', data_ret)
|
response = self.MakeRequest('verifyLogin', data_ret)
|
||||||
self.assertEqual(response['loginStatus'], 1)
|
self.assertEqual(response['loginStatus'], 1)
|
||||||
|
|
||||||
@@ -51,19 +51,27 @@ class TestWebsiteManagement(TestCase):
|
|||||||
|
|
||||||
self.assertEqual(exists, 1)
|
self.assertEqual(exists, 1)
|
||||||
|
|
||||||
|
def test_submitWebsiteDeletion(self):
|
||||||
|
|
||||||
|
## Login
|
||||||
|
|
||||||
|
data_ret = {'websiteName': 'hello.cyberpanel.xyz'}
|
||||||
|
|
||||||
|
response = self.MakeRequest('websites/submitWebsiteDeletion', data_ret)
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
self.assertEqual(response['status'], 1)
|
||||||
|
|
||||||
|
def test_submitWebsiteModify(self):
|
||||||
|
|
||||||
data_ret = {'domainName': 'hey.cyberpanel.xyz', 'adminEmail': 'usman@cyberpersons.com',
|
data_ret = {'domainName': 'hey.cyberpanel.xyz', 'adminEmail': 'usman@cyberpersons.com',
|
||||||
'phpSelection': 'PHP 7.1',
|
'phpSelection': 'PHP 7.1',
|
||||||
'package': 'Default', 'websiteOwner': 'admin', 'ssl': 0, 'dkimCheck': 0, 'openBasedir': 0}
|
'package': 'Default', 'websiteOwner': 'admin', 'ssl': 0, 'dkimCheck': 0, 'openBasedir': 0}
|
||||||
self.MakeRequest('websites/submitWebsiteCreation', data_ret)
|
self.MakeRequest('websites/submitWebsiteCreation', data_ret)
|
||||||
|
|
||||||
data_ret = {'domainName': 'suspend.cyberpanel.xyz', 'adminEmail': 'usman@cyberpersons.com',
|
time.sleep(10)
|
||||||
'phpSelection': 'PHP 7.1',
|
|
||||||
'package': 'Default', 'websiteOwner': 'admin', 'ssl': 0, 'dkimCheck': 0, 'openBasedir': 0}
|
|
||||||
self.MakeRequest('websites/submitWebsiteCreation', data_ret)
|
|
||||||
|
|
||||||
def test_submitWebsiteModify(self):
|
##
|
||||||
|
|
||||||
## Login
|
|
||||||
|
|
||||||
data_ret = {'domain': 'hey.cyberpanel.xyz', 'email': 'usman@cyberpersons.com' , 'phpVersion': 'PHP 7.3',
|
data_ret = {'domain': 'hey.cyberpanel.xyz', 'email': 'usman@cyberpersons.com' , 'phpVersion': 'PHP 7.3',
|
||||||
'packForWeb': 'Default', 'admin': 'admin'}
|
'packForWeb': 'Default', 'admin': 'admin'}
|
||||||
@@ -92,19 +100,13 @@ phpinfo();
|
|||||||
|
|
||||||
self.assertEqual(exists, 1)
|
self.assertEqual(exists, 1)
|
||||||
|
|
||||||
def test_submitWebsiteDeletion(self):
|
|
||||||
|
|
||||||
## Login
|
|
||||||
|
|
||||||
data_ret = {'websiteName': 'hello.cyberpanel.xyz'}
|
|
||||||
|
|
||||||
response = self.MakeRequest('websites/submitWebsiteDeletion', data_ret)
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
self.assertEqual(response['status'], 1)
|
|
||||||
|
|
||||||
def test_submitWebsiteStatus(self):
|
def test_submitWebsiteStatus(self):
|
||||||
|
|
||||||
|
data_ret = {'domainName': 'suspend.cyberpanel.xyz', 'adminEmail': 'usman@cyberpersons.com',
|
||||||
|
'phpSelection': 'PHP 7.1',
|
||||||
|
'package': 'Default', 'websiteOwner': 'admin', 'ssl': 0, 'dkimCheck': 0, 'openBasedir': 0}
|
||||||
|
self.MakeRequest('websites/submitWebsiteCreation', data_ret)
|
||||||
|
|
||||||
## Suspend check
|
## Suspend check
|
||||||
data_ret = {'websiteName': 'suspend.cyberpanel.xyz', 'state': 'Suspend'}
|
data_ret = {'websiteName': 'suspend.cyberpanel.xyz', 'state': 'Suspend'}
|
||||||
|
|
||||||
@@ -154,12 +156,20 @@ phpinfo();
|
|||||||
|
|
||||||
def test_installWordpress(self):
|
def test_installWordpress(self):
|
||||||
|
|
||||||
|
command = 'rm -rf /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
command = 'mkdir /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
command = 'chown cyberpa:cyberpa /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
## Suspend check
|
## Suspend check
|
||||||
data_ret = {'domain': 'cyberpanel.xyz', 'home': '1', 'blogTitle': 'Unit Test', 'adminUser': 'cyberpanel',
|
data_ret = {'domain': 'cyberpanel.xyz', 'home': '1', 'blogTitle': 'Unit Test', 'adminUser': 'cyberpanel',
|
||||||
'passwordByPass': 'helloworld', 'adminEmail': 'usman@cyberpersons.com'}
|
'passwordByPass': 'helloworld', 'adminEmail': 'usman@cyberpersons.com'}
|
||||||
|
|
||||||
response = self.MakeRequest('websites/installWordpress', data_ret)
|
response = self.MakeRequest('websites/installWordpress', data_ret)
|
||||||
logging.writeToFile(str(response))
|
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@@ -168,7 +178,7 @@ phpinfo();
|
|||||||
|
|
||||||
## Wait for install to complete
|
## Wait for install to complete
|
||||||
|
|
||||||
data_ret = {'statusFile': tempStatusPath}
|
data_ret = {'statusFile': tempStatusPath, 'domainName': 'cyberpanel.xyz'}
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
response = self.MakeRequest('websites/installWordpressStatus', data_ret)
|
response = self.MakeRequest('websites/installWordpressStatus', data_ret)
|
||||||
@@ -187,6 +197,50 @@ phpinfo();
|
|||||||
|
|
||||||
self.assertEqual(exists, 1)
|
self.assertEqual(exists, 1)
|
||||||
|
|
||||||
|
def test_installJoomla(self):
|
||||||
|
|
||||||
|
command = 'rm -rf /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
command = 'mkdir /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
command = 'chown cyberpa:cyberpa /home/%s/public_html/' % ('cyberpanel.xyz')
|
||||||
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
## Suspend check
|
||||||
|
data_ret = {'domain': 'cyberpanel.xyz', 'home': '1', 'sitename': 'Unit Test Joomla', 'username': 'cyberpanel',
|
||||||
|
'passwordByPass': 'helloworld', 'prefix': 'db_'}
|
||||||
|
|
||||||
|
response = self.MakeRequest('websites/installJoomla', data_ret)
|
||||||
|
logging.writeToFile('jl: ' + str(response))
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
self.assertEqual(response['status'], 1)
|
||||||
|
tempStatusPath = response['tempStatusPath']
|
||||||
|
|
||||||
|
## Wait for install to complete
|
||||||
|
|
||||||
|
data_ret = {'statusFile': tempStatusPath, 'domainName': 'cyberpanel.xyz'}
|
||||||
|
|
||||||
|
while True:
|
||||||
|
response = self.MakeRequest('websites/installWordpressStatus', data_ret)
|
||||||
|
time.sleep(1)
|
||||||
|
if response['abort'] == 1:
|
||||||
|
if response['installStatus'] == 1:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
logging.writeToFile(response['error_message'])
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
exists = 0
|
||||||
|
|
||||||
|
if self.MakeRequestRaw('http://cyberpanel.xyz').find('Unit Test Joomla') > -1:
|
||||||
|
exists = 1
|
||||||
|
|
||||||
|
self.assertEqual(exists, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1804,17 +1804,7 @@ class WebsiteManager:
|
|||||||
statusFile.writelines('Downloading Joomla Core..,20')
|
statusFile.writelines('Downloading Joomla Core..,20')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
virtualHostUtilities.installJoomla(domainName, finalPath, externalApp, dbName, dbUser, dbPassword, username, password, prefix, sitename, tempStatusPath)
|
||||||
|
|
||||||
execPath = execPath + " installJoomla --virtualHostName " + domainName + \
|
|
||||||
" --virtualHostUser " + externalApp + " --path " + finalPath + " --dbName " + dbName + \
|
|
||||||
" --dbUser " + dbUser + " --dbPassword " + dbPassword + " --username " + username + \
|
|
||||||
" --password " + password + " --prefix " + prefix + " --sitename '" + sitename + "'" \
|
|
||||||
+ " --tempStatusPath " + tempStatusPath
|
|
||||||
|
|
||||||
# return execPath
|
|
||||||
|
|
||||||
ProcessUtilities.popenExecutioner(execPath, externalApp)
|
|
||||||
|
|
||||||
data_ret = {'status': 1, "installStatus": 1, 'tempStatusPath': tempStatusPath}
|
data_ret = {'status': 1, "installStatus": 1, 'tempStatusPath': tempStatusPath}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user