mirror of
				https://github.com/usmannasir/cyberpanel.git
				synced 2025-10-31 02:15:55 +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: | ||||
|             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' | ||||
|             subprocess.check_output(shlex.split(command)) | ||||
|  | ||||
| @@ -487,6 +493,26 @@ class ApplicationInstaller(multi.Thread): | ||||
|     def detachRepo(self): | ||||
|         try: | ||||
|             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' | ||||
|             subprocess.check_output(shlex.split(command)) | ||||
| @@ -494,9 +520,6 @@ class ApplicationInstaller(multi.Thread): | ||||
|             command = 'sudo mkdir  /home/' + domain + '/public_html' | ||||
|             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' | ||||
| @@ -705,6 +728,23 @@ class ApplicationInstaller(multi.Thread): | ||||
|         try: | ||||
|             domainName = self.extraArgs['domainName'] | ||||
|             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: | ||||
|                 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") | ||||
|             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) | ||||
|  | ||||
|             ## Remove backups already sent to remote destinations | ||||
|  | ||||
|             os.remove(backupPath) | ||||
|  | ||||
|         except BaseException, msg: | ||||
|             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 | ||||
|     def generateKeys(domain): | ||||
|         try: | ||||
|  | ||||
|             result = mailUtilities.setupDKIM(domain) | ||||
|             if result[0] == 0: | ||||
|                 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 | ||||
|     def addRewriteRules(virtualHostName, fileName=None): | ||||
|  | ||||
|         try: | ||||
|             pass | ||||
|         except BaseException, msg: | ||||
| @@ -679,11 +678,8 @@ RewriteFile .htaccess | ||||
|     def permissionControl(path): | ||||
|         try: | ||||
|             command = 'sudo chown -R  cyberpanel:cyberpanel ' + path | ||||
|  | ||||
|             cmd = shlex.split(command) | ||||
|  | ||||
|             res = subprocess.call(cmd) | ||||
|  | ||||
|         except BaseException, 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} | ||||
|                 json_data = json.dumps(data_ret) | ||||
|                 return HttpResponse(json_data) | ||||
|  | ||||
|  | ||||
|     except BaseException, msg: | ||||
|         data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0} | ||||
|         json_data = json.dumps(data_ret) | ||||
| @@ -2522,6 +2524,7 @@ def setupGit(request, domain): | ||||
|                 ipAddress = ipData.split('\n', 1)[0] | ||||
|  | ||||
|                 webhookURL = 'https://' + ipAddress + ':8090/websites/' + domain + '/gitNotify' | ||||
|  | ||||
|                 return render(request, 'websiteFunctions/setupGit.html', | ||||
|                               {'domainName': domain, 'installed': 1, 'webhookURL': webhookURL}) | ||||
|             else: | ||||
| @@ -2577,7 +2580,6 @@ def setupGitRepo(request): | ||||
|         logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]") | ||||
|         return HttpResponse("Not Logged in as admin") | ||||
|  | ||||
|  | ||||
| def gitNotify(request, domain): | ||||
|     try: | ||||
|         if request.method == 'POST': | ||||
| @@ -2604,7 +2606,6 @@ def gitNotify(request, domain): | ||||
|         json_data = json.dumps(data_ret) | ||||
|         return HttpResponse(json_data) | ||||
|  | ||||
|  | ||||
| def detachRepo(request): | ||||
|     try: | ||||
|         val = request.session['userID'] | ||||
| @@ -2618,6 +2619,7 @@ def detachRepo(request): | ||||
|  | ||||
|                 extraArgs = {} | ||||
|                 extraArgs['domainName'] = data['domain'] | ||||
|                 extraArgs['admin'] = admin | ||||
|  | ||||
|  | ||||
|                 background = ApplicationInstaller('detach', extraArgs) | ||||
| @@ -2655,6 +2657,7 @@ def changeBranch(request): | ||||
|                 extraArgs = {} | ||||
|                 extraArgs['domainName'] = data['domain'] | ||||
|                 extraArgs['githubBranch'] = data['githubBranch'] | ||||
|                 extraArgs['admin'] = admin | ||||
|  | ||||
|  | ||||
|                 background = ApplicationInstaller('changeBranch', extraArgs) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user