diff --git a/websiteFunctions/tests.py b/websiteFunctions/tests.py index d873cd479..837a79ed5 100755 --- a/websiteFunctions/tests.py +++ b/websiteFunctions/tests.py @@ -256,7 +256,6 @@ phpinfo(); 'passwordByPass': 'helloworld', 'databasePrefix': 'db_', 'email': 'usman@cyberpersons.com'} response = self.MakeRequest('websites/prestaShopInstall', data_ret) - logging.writeToFile('ps: ' + str(response)) time.sleep(2) self.assertEqual(response['status'], 1) @@ -284,6 +283,50 @@ phpinfo(); self.assertEqual(exists, 1) + def test_magentoInstall(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','firstName': 'Usman', 'lastName': 'Nasir', + 'passwordByPass': 'helloworld1234', 'sampleData': False, 'email': 'usman@cyberpersons.com', 'username': 'usman'} + + response = self.MakeRequest('websites/magentoInstall', data_ret) + logging.writeToFile('ps: ' + 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('Magento') > -1: + exists = 1 + + self.assertEqual(exists, 1) + diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index ca039d49f..123761cd8 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1068,21 +1068,16 @@ class WebsiteManager: ## save configuration data - execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" - execPath = execPath + " saveRewriteRules --virtualHostName " + self.domain + " --path " + filePath + " --tempPath " + tempPath - logging.CyberCPLogFileWriter.writeToFile(execPath) + command = 'cp %s %s' % (tempPath, filePath) + ProcessUtilities.executioner(command, externalApp) - output = ProcessUtilities.outputExecutioner(execPath, externalApp) + command = 'rm -f %s' % (tempPath) + ProcessUtilities.executioner(command, 'cyberpanel') - if output.find("1,None") > -1: - installUtilities.reStartLiteSpeedSocket() - status = {"rewriteStatus": 1, 'error_message': output} - final_json = json.dumps(status) - return HttpResponse(final_json) - else: - data_ret = {'rewriteStatus': 0, 'error_message': output} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + installUtilities.reStartLiteSpeedSocket() + status = {"rewriteStatus": 1, 'error_message': 'None'} + final_json = json.dumps(status) + return HttpResponse(final_json) def saveSSL(self, userID=None, data=None):