diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 349213351..a595cb22b 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -246,7 +246,10 @@ class ProcessUtilities(multi.Thread): def outputExecutioner(command, user=None): try: if getpass.getuser() == 'root': - return subprocess.check_output(command, shell=True).decode("utf-8") + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(command) + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return p.communicate()[0].decode("utf-8") if type(command) == list: command = " ".join(command) diff --git a/plogical/test.py b/plogical/test.py index 01c7bee99..e69de29bb 100755 --- a/plogical/test.py +++ b/plogical/test.py @@ -1,4 +0,0 @@ -import subprocess - -command = 'git -C /home/usman/Backup/CyberCP commit -m "Auto commit by CyberPanel Daily cron on"' -print(subprocess.check_output(command, shell=True).decode("utf-8")) \ No newline at end of file diff --git a/plogical/upgrade.py b/plogical/upgrade.py index f8015ddc7..1f136fa09 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -1240,6 +1240,22 @@ class Upgrade: except: pass + query = """CREATE TABLE `websiteFunctions_gitlogs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` datetime(6) NOT NULL, + `type` varchar(5) NOT NULL, + `message` longtext NOT NULL, + `owner_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `websiteFunctions_git_owner_id_ce74c7de_fk_websiteFu` (`owner_id`), + CONSTRAINT `websiteFunctions_git_owner_id_ce74c7de_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_websites` (`id`) +)""" + + try: + cursor.execute(query) + except: + pass + try: connection.close() except: diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 3f2d8c18e..41373e45a 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -3393,12 +3393,12 @@ StrictHostKeyChecking no command = 'git -C %s push --set-upstream origin %s' % (self.folder, currentBranch) commandStatus = ProcessUtilities.outputExecutioner(command) - if commandStatus.find('Everything up-to-date') == -1 and commandStatus.find('rejected') == -1: + if commandStatus.find('Everything up-to-date') == -1 and commandStatus.find('rejected') == -1 and commandStatus.find('Permission denied') == -1: data_ret = {'status': 1, 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data) else: - data_ret = {'status': 0, 'error_message': 'Push not required.', 'commandStatus': commandStatus} + data_ret = {'status': 0, 'error_message': 'Push failed.', 'commandStatus': commandStatus} json_data = json.dumps(data_ret) return HttpResponse(json_data)