mirror of
				https://github.com/usmannasir/cyberpanel.git
				synced 2025-10-31 18:36:17 +01:00 
			
		
		
		
	Bug fix to Backup Engine
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -465,6 +465,12 @@ class ApplicationInstaller(multi.Thread): | |||||||
|         try: |         try: | ||||||
|             domain = self.extraArgs['domain'] |             domain = self.extraArgs['domain'] | ||||||
|  |  | ||||||
|  |             path = '/home/cyberpanel/' + domain + '.git' | ||||||
|  |  | ||||||
|  |             if not os.path.exists(path): | ||||||
|  |                 logging.writeToFile('Git is not setup for this website.') | ||||||
|  |                 return 0 | ||||||
|  |  | ||||||
|             command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel  -o StrictHostKeyChecking=no" git -C /home/' + domain + '/public_html/  pull' |             command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel  -o StrictHostKeyChecking=no" git -C /home/' + domain + '/public_html/  pull' | ||||||
|             subprocess.check_output(shlex.split(command)) |             subprocess.check_output(shlex.split(command)) | ||||||
|  |  | ||||||
| @@ -487,6 +493,26 @@ class ApplicationInstaller(multi.Thread): | |||||||
|     def detachRepo(self): |     def detachRepo(self): | ||||||
|         try: |         try: | ||||||
|             domain = self.extraArgs['domainName'] |             domain = self.extraArgs['domainName'] | ||||||
|  |             admin = self.extraArgs['admin'] | ||||||
|  |  | ||||||
|  |             try: | ||||||
|  |                 website = ChildDomains.objects.get(domain=domain) | ||||||
|  |                 externalApp = website.master.externalApp | ||||||
|  |  | ||||||
|  |                 if admin.type != 1: | ||||||
|  |                     if website.master.admin != admin: | ||||||
|  |                         logging.writeToFile("You do not own this website, detach failed. [404]") | ||||||
|  |                         return 0 | ||||||
|  |  | ||||||
|  |             except: | ||||||
|  |                 website = Websites.objects.get(domain=domain) | ||||||
|  |                 externalApp = website.externalApp | ||||||
|  |  | ||||||
|  |                 if admin.type != 1: | ||||||
|  |                     if website.admin != admin: | ||||||
|  |                         logging.writeToFile("You do not own this website, detach failed. [404]") | ||||||
|  |                         return 0 | ||||||
|  |  | ||||||
|  |  | ||||||
|             command = 'sudo rm -rf  /home/' + domain + '/public_html' |             command = 'sudo rm -rf  /home/' + domain + '/public_html' | ||||||
|             subprocess.check_output(shlex.split(command)) |             subprocess.check_output(shlex.split(command)) | ||||||
| @@ -494,9 +520,6 @@ class ApplicationInstaller(multi.Thread): | |||||||
|             command = 'sudo mkdir  /home/' + domain + '/public_html' |             command = 'sudo mkdir  /home/' + domain + '/public_html' | ||||||
|             subprocess.check_output(shlex.split(command)) |             subprocess.check_output(shlex.split(command)) | ||||||
|  |  | ||||||
|             website = Websites.objects.get(domain=domain) |  | ||||||
|             externalApp = website.externalApp |  | ||||||
|  |  | ||||||
|             ## |             ## | ||||||
|  |  | ||||||
|             command = "sudo chown -R " + externalApp + ":" + externalApp + " " + '/home/' + domain + '/public_html' |             command = "sudo chown -R " + externalApp + ":" + externalApp + " " + '/home/' + domain + '/public_html' | ||||||
| @@ -705,6 +728,23 @@ class ApplicationInstaller(multi.Thread): | |||||||
|         try: |         try: | ||||||
|             domainName = self.extraArgs['domainName'] |             domainName = self.extraArgs['domainName'] | ||||||
|             githubBranch = self.extraArgs['githubBranch'] |             githubBranch = self.extraArgs['githubBranch'] | ||||||
|  |             admin = self.extraArgs['admin'] | ||||||
|  |  | ||||||
|  |             try: | ||||||
|  |                 website = ChildDomains.objects.get(domain=domainName) | ||||||
|  |  | ||||||
|  |                 if admin.type != 1: | ||||||
|  |                     if website.master.admin != admin: | ||||||
|  |                         logging.writeToFile("You do not own this website, failed to change branch. [404]") | ||||||
|  |                         return 0 | ||||||
|  |  | ||||||
|  |             except: | ||||||
|  |                 website = Websites.objects.get(domain=domainName) | ||||||
|  |  | ||||||
|  |                 if admin.type != 1: | ||||||
|  |                     if website.admin != admin: | ||||||
|  |                         logging.writeToFile("You do not own this website, failed to change branch. [404]") | ||||||
|  |                         return 0 | ||||||
|  |  | ||||||
|             try: |             try: | ||||||
|                 command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel  -o StrictHostKeyChecking=no" git -C /home/' + domainName + '/public_html/  checkout -b' + githubBranch |                 command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel  -o StrictHostKeyChecking=no" git -C /home/' + domainName + '/public_html/  checkout -b' + githubBranch | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								plogical/applicationInstaller.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plogical/applicationInstaller.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -83,6 +83,11 @@ class backupSchedule: | |||||||
|             writeToFile = open(backupLogPath, "a") |             writeToFile = open(backupLogPath, "a") | ||||||
|             command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/" |             command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/" | ||||||
|             subprocess.call(shlex.split(command), stdout=writeToFile) |             subprocess.call(shlex.split(command), stdout=writeToFile) | ||||||
|  |  | ||||||
|  |             ## Remove backups already sent to remote destinations | ||||||
|  |  | ||||||
|  |             os.remove(backupPath) | ||||||
|  |  | ||||||
|         except BaseException, msg: |         except BaseException, msg: | ||||||
|             logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]") |             logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]") | ||||||
|  |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								plogical/filemanager.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plogical/filemanager.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -235,7 +235,6 @@ class mailUtilities: | |||||||
|     @staticmethod |     @staticmethod | ||||||
|     def generateKeys(domain): |     def generateKeys(domain): | ||||||
|         try: |         try: | ||||||
|  |  | ||||||
|             result = mailUtilities.setupDKIM(domain) |             result = mailUtilities.setupDKIM(domain) | ||||||
|             if result[0] == 0: |             if result[0] == 0: | ||||||
|                 raise BaseException(result[1]) |                 raise BaseException(result[1]) | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								plogical/mailUtilities.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plogical/mailUtilities.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								plogical/serverLogs.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plogical/serverLogs.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -611,7 +611,6 @@ RewriteFile .htaccess | |||||||
|  |  | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def addRewriteRules(virtualHostName, fileName=None): |     def addRewriteRules(virtualHostName, fileName=None): | ||||||
|  |  | ||||||
|         try: |         try: | ||||||
|             pass |             pass | ||||||
|         except BaseException, msg: |         except BaseException, msg: | ||||||
| @@ -679,11 +678,8 @@ RewriteFile .htaccess | |||||||
|     def permissionControl(path): |     def permissionControl(path): | ||||||
|         try: |         try: | ||||||
|             command = 'sudo chown -R  cyberpanel:cyberpanel ' + path |             command = 'sudo chown -R  cyberpanel:cyberpanel ' + path | ||||||
|  |  | ||||||
|             cmd = shlex.split(command) |             cmd = shlex.split(command) | ||||||
|  |  | ||||||
|             res = subprocess.call(cmd) |             res = subprocess.call(cmd) | ||||||
|  |  | ||||||
|         except BaseException, msg: |         except BaseException, msg: | ||||||
|             logging.CyberCPLogFileWriter.writeToFile(str(msg)) |             logging.CyberCPLogFileWriter.writeToFile(str(msg)) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								plogical/vhost.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								plogical/vhost.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -259,6 +259,8 @@ def submitWebsiteCreation(request): | |||||||
|                 data_ret = {'createWebSiteStatus': 0, 'error_message': output, "existsStatus": 0} |                 data_ret = {'createWebSiteStatus': 0, 'error_message': output, "existsStatus": 0} | ||||||
|                 json_data = json.dumps(data_ret) |                 json_data = json.dumps(data_ret) | ||||||
|                 return HttpResponse(json_data) |                 return HttpResponse(json_data) | ||||||
|  |  | ||||||
|  |  | ||||||
|     except BaseException, msg: |     except BaseException, msg: | ||||||
|         data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0} |         data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0} | ||||||
|         json_data = json.dumps(data_ret) |         json_data = json.dumps(data_ret) | ||||||
| @@ -2522,6 +2524,7 @@ def setupGit(request, domain): | |||||||
|                 ipAddress = ipData.split('\n', 1)[0] |                 ipAddress = ipData.split('\n', 1)[0] | ||||||
|  |  | ||||||
|                 webhookURL = 'https://' + ipAddress + ':8090/websites/' + domain + '/gitNotify' |                 webhookURL = 'https://' + ipAddress + ':8090/websites/' + domain + '/gitNotify' | ||||||
|  |  | ||||||
|                 return render(request, 'websiteFunctions/setupGit.html', |                 return render(request, 'websiteFunctions/setupGit.html', | ||||||
|                               {'domainName': domain, 'installed': 1, 'webhookURL': webhookURL}) |                               {'domainName': domain, 'installed': 1, 'webhookURL': webhookURL}) | ||||||
|             else: |             else: | ||||||
| @@ -2577,7 +2580,6 @@ def setupGitRepo(request): | |||||||
|         logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]") |         logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]") | ||||||
|         return HttpResponse("Not Logged in as admin") |         return HttpResponse("Not Logged in as admin") | ||||||
|  |  | ||||||
|  |  | ||||||
| def gitNotify(request, domain): | def gitNotify(request, domain): | ||||||
|     try: |     try: | ||||||
|         if request.method == 'POST': |         if request.method == 'POST': | ||||||
| @@ -2604,7 +2606,6 @@ def gitNotify(request, domain): | |||||||
|         json_data = json.dumps(data_ret) |         json_data = json.dumps(data_ret) | ||||||
|         return HttpResponse(json_data) |         return HttpResponse(json_data) | ||||||
|  |  | ||||||
|  |  | ||||||
| def detachRepo(request): | def detachRepo(request): | ||||||
|     try: |     try: | ||||||
|         val = request.session['userID'] |         val = request.session['userID'] | ||||||
| @@ -2618,6 +2619,7 @@ def detachRepo(request): | |||||||
|  |  | ||||||
|                 extraArgs = {} |                 extraArgs = {} | ||||||
|                 extraArgs['domainName'] = data['domain'] |                 extraArgs['domainName'] = data['domain'] | ||||||
|  |                 extraArgs['admin'] = admin | ||||||
|  |  | ||||||
|  |  | ||||||
|                 background = ApplicationInstaller('detach', extraArgs) |                 background = ApplicationInstaller('detach', extraArgs) | ||||||
| @@ -2655,6 +2657,7 @@ def changeBranch(request): | |||||||
|                 extraArgs = {} |                 extraArgs = {} | ||||||
|                 extraArgs['domainName'] = data['domain'] |                 extraArgs['domainName'] = data['domain'] | ||||||
|                 extraArgs['githubBranch'] = data['githubBranch'] |                 extraArgs['githubBranch'] = data['githubBranch'] | ||||||
|  |                 extraArgs['admin'] = admin | ||||||
|  |  | ||||||
|  |  | ||||||
|                 background = ApplicationInstaller('changeBranch', extraArgs) |                 background = ApplicationInstaller('changeBranch', extraArgs) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user