From bad53db454afedc1a87dc4f7d1f5ba067bd4cf76 Mon Sep 17 00:00:00 2001 From: Hassan Hashmi <75794688+hassanhashmey@users.noreply.github.com> Date: Tue, 6 Feb 2024 13:03:29 +0500 Subject: [PATCH 1/2] made changes in updatemysql --- CyberCP/settings.py | 2 +- databases/databaseManager.py | 8 +++ databases/static/databases/databases.js | 59 ++++++++++++++++- .../templates/databases/Updatemysql.html | 63 +++++++++++++++++++ .../templates/databases/mysqlmanager.html | 3 + databases/urls.py | 2 + databases/views.py | 49 +++++++++++++-- 7 files changed, 179 insertions(+), 7 deletions(-) create mode 100644 databases/templates/databases/Updatemysql.html diff --git a/CyberCP/settings.py b/CyberCP/settings.py index 031ca5f63..0c4fe719b 100755 --- a/CyberCP/settings.py +++ b/CyberCP/settings.py @@ -24,7 +24,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmjg4)q&19f' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = True ALLOWED_HOSTS = ['*'] diff --git a/databases/databaseManager.py b/databases/databaseManager.py index c2a17d05c..312f29acf 100755 --- a/databases/databaseManager.py +++ b/databases/databaseManager.py @@ -130,6 +130,14 @@ class DatabaseManager: proc = httpProc(request, template, data, 'admin') return proc.render() + def Upgardemysql(self, request = None, userID = None): + data={} + data['mysqlversions']=['10.6','10.11'] + template = 'databases/Updatemysql.html' + proc = httpProc(request, template, data, 'admin') + return proc.render() + + def fetchDatabases(self, userID = None, data = None): try: diff --git a/databases/static/databases/databases.js b/databases/static/databases/databases.js index d924674ce..6ca0b2c46 100755 --- a/databases/static/databases/databases.js +++ b/databases/static/databases/databases.js @@ -836,4 +836,61 @@ app.controller('OptimizeMysql', function ($scope, $http) { }); } } -}) \ No newline at end of file +}) + + +app.controller('mysqlupdate', function ($scope, $http, $timeout) { + $scope.cyberPanelLoading = true; + $scope.dbLoading = true; + $scope.installlogs = true; + + $scope.Upgardemysql = function () { + $scope.dbLoading = false; + $scope.installform = true; + + + url = "/dataBases/upgrademysqlnow"; + + var data = { + mysqlversion: $scope.version + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); + + + function ListInitialData(response) { + $scope.cyberhosting = true; + if (response.data.status === 1) { + $scope.installlogs = false; + + $timeout(getRequestStatus, 1000); + + } else { + new PNotify({ + title: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialData(response) { + $scope.cyberhosting = true; + new PNotify({ + title: 'Error!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + } + } + + + $scope.getRequestStatus +}); \ No newline at end of file diff --git a/databases/templates/databases/Updatemysql.html b/databases/templates/databases/Updatemysql.html new file mode 100644 index 000000000..8e0749327 --- /dev/null +++ b/databases/templates/databases/Updatemysql.html @@ -0,0 +1,63 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "List Databases - CyberPanel" %}{% endblock %} +{% block content %} + + {% load static %} + {% get_current_language as LANGUAGE_CODE %} + + + +
{% trans "On this page you can update mysql." %}
+
+
+ src="{% static 'images/loading.gif' %}">
{% trans "Failed to start installation, Error message: " %} {$ errorMessage + $}
+{% trans "Could not connect. Please refresh this page." %}
+{% trans "Installation failed." %} {$ errorMessage $}
+{% trans "CSF successfully installed, refreshing page in 3 seconds.." %}
+