mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-01 00:08:47 +02:00
resolve merge conflicts
This commit is contained in:
@@ -191,12 +191,18 @@ class StagingSetup(multi.Thread):
|
||||
logging.statusWriter(tempStatusPath, 'Syncing databases..,10')
|
||||
|
||||
command = 'wp --allow-root --skip-plugins --skip-themes --path=%s db export %s/dbexport-stage.sql' % (child.path, masterPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(result)
|
||||
|
||||
## Restore to master domain
|
||||
|
||||
command = 'wp --allow-root --skip-plugins --skip-themes --path=%s --quiet db import %s/dbexport-stage.sql' % (masterPath, masterPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(result)
|
||||
|
||||
try:
|
||||
command = 'rm -f %s/dbexport-stage.sql' % (masterPath)
|
||||
@@ -211,6 +217,9 @@ class StagingSetup(multi.Thread):
|
||||
command = 'wp theme path --allow-root --skip-plugins --skip-themes --path=%s' % (masterPath)
|
||||
WpContentPath = ProcessUtilities.outputExecutioner(command).splitlines()[-1].replace('wp-content/themes', '')
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(WpContentPath)
|
||||
|
||||
command = 'cp -R %s/wp-content/ %s' % (child.path, WpContentPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
@@ -222,10 +231,16 @@ class StagingSetup(multi.Thread):
|
||||
## Search and replace url
|
||||
|
||||
command = 'wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "%s" "%s"' % (masterPath, child.domain, replaceDomain)
|
||||
ProcessUtilities.executioner(command)
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(result)
|
||||
|
||||
command = 'wp search-replace --allow-root --skip-plugins --skip-themes --path=%s "www.%s" "%s"' % (masterPath, child.domain, replaceDomain)
|
||||
ProcessUtilities.executioner(command)
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.writeToFile(result)
|
||||
|
||||
from filemanager.filemanager import FileManager
|
||||
|
||||
@@ -237,15 +252,6 @@ class StagingSetup(multi.Thread):
|
||||
|
||||
logging.statusWriter(tempStatusPath, 'Completed,[200]')
|
||||
|
||||
http = []
|
||||
finalHTTP = []
|
||||
|
||||
for items in http:
|
||||
if items.find('x-litespeed-cache') > -1 or items.find('x-lsadc-cache') > -1 or items.find('x-qc-cache') > -1:
|
||||
finalHTTP.append('<strong>%s</strong>' % (items))
|
||||
else:
|
||||
finalHTTP.append(items)
|
||||
|
||||
return 0
|
||||
except BaseException as msg:
|
||||
mesg = '%s. [404]' % (str(msg))
|
||||
|
||||
@@ -11,8 +11,8 @@ from datetime import datetime
|
||||
class Websites(models.Model):
|
||||
admin = models.ForeignKey(Administrator, on_delete=models.PROTECT)
|
||||
package = models.ForeignKey(Package, on_delete=models.PROTECT)
|
||||
domain = models.CharField(max_length=50,unique=True)
|
||||
adminEmail = models.CharField(max_length=50)
|
||||
domain = models.CharField(max_length=255,unique=True)
|
||||
adminEmail = models.CharField(max_length=255)
|
||||
phpSelection = models.CharField(max_length=10)
|
||||
ssl = models.IntegerField()
|
||||
state = models.IntegerField(default=1)
|
||||
|
||||
@@ -1896,7 +1896,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.sslStatus == 1) {
|
||||
if (response.data.sslStatus === 1) {
|
||||
|
||||
$scope.sslSaved = false;
|
||||
$scope.couldNotSaveSSL = true;
|
||||
@@ -2040,9 +2040,14 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
|
||||
var statusFile;
|
||||
|
||||
$scope.WebsiteSelection = function (){
|
||||
$scope.DomainCreateForm = false;
|
||||
};
|
||||
|
||||
$scope.createDomain = function () {
|
||||
|
||||
$scope.domainLoading = false;
|
||||
@@ -2053,6 +2058,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
$scope.currentStatus = "Starting creation..";
|
||||
$scope.DomainCreateForm = true;
|
||||
|
||||
var ssl, dkimCheck, openBasedir;
|
||||
|
||||
@@ -2091,7 +2097,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
phpSelection: phpSelection,
|
||||
ssl: ssl,
|
||||
path: path,
|
||||
masterDomain: $("#domainNamePage").text(),
|
||||
masterDomain: $scope.masterDomain,
|
||||
dkimCheck: dkimCheck,
|
||||
openBasedir: openBasedir
|
||||
};
|
||||
@@ -2114,6 +2120,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.domainLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = false;
|
||||
$scope.success = true;
|
||||
@@ -2130,6 +2137,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.domainLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
@@ -2144,11 +2152,13 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
$scope.goBack = function () {
|
||||
$scope.domainLoading = true;
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.DomainCreateForm = true;
|
||||
$scope.installationProgress = true;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
$("#installProgress").css("width", "0%");
|
||||
};
|
||||
|
||||
@@ -2194,6 +2204,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.domainLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = false;
|
||||
$scope.success = true;
|
||||
@@ -2221,6 +2232,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.domainLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.DomainCreateForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
|
||||
158
websiteFunctions/templates/websiteFunctions/createDomain.html
Executable file
158
websiteFunctions/templates/websiteFunctions/createDomain.html
Executable file
@@ -0,0 +1,158 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create New Domain - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Create Child Domain" %}</h2>
|
||||
<p>{% trans "Create child-domains, child domains are owned by a master website. " %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="websitePages" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Details" %} <img ng-hide="domainLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Website" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="WebsiteSelection()" ng-model="masterDomain" class="form-control">
|
||||
{% for items in websiteList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="DomainCreateForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control"
|
||||
ng-model="domainNameCreate" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="DomainCreateForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Path" %}: /home/{$ masterDomain $}/ </label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="docRootPath" required>
|
||||
</div>
|
||||
<div ng-show="websiteCreationForm.dom.$error.pattern"
|
||||
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="DomainCreateForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="phpSelection" class="form-control">
|
||||
{% for php in phps %}
|
||||
<option>{{ php }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="DomainCreateForm" ng-hide="installationDetailsForm"
|
||||
class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="sslCheck" type="checkbox" value="">
|
||||
SSL
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="dkimCheck" type="checkbox" value="">
|
||||
DKIM Support
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="openBasedir" type="checkbox" value="">
|
||||
open_basedir Protection
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="DomainCreateForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="createDomain()"
|
||||
class="btn btn-primary btn-lg">{% trans "Create Domain" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-7">
|
||||
|
||||
<div class="alert alert-success text-center">
|
||||
<h2>{$ currentStatus $}</h2>
|
||||
</div>
|
||||
|
||||
<div class="progress">
|
||||
<div id="installProgress" class="progress-bar" role="progressbar"
|
||||
aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"
|
||||
style="width:0%">
|
||||
<span class="sr-only">70% Complete</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="errorMessageBox" class="alert alert-danger">
|
||||
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="success" class="alert alert-success">
|
||||
<p>{% trans "Website succesfully created." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()"
|
||||
class="btn btn-primary btn-lg">{% trans "Go Back" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -17,7 +17,7 @@
|
||||
<div ng-controller="installWordPressCTRL" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
<span id="domainNamePage">{{ domainName }}</span> - {% trans "Installation Details" %} <img ng-hide="wpInstallLoading" src="{% static 'images/loading.gif' %}">
|
||||
<span id="domainNamePage">{{ domainName }}</span> - {% trans "Installation Details" %} - <a href="https://go.cyberpanel.net/StessTest">Stress Test</a></strong> <img ng-hide="wpInstallLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
@@ -84,19 +84,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div ng-hide="installationFailed" class="alert alert-danger">
|
||||
<p>{% trans "Installation failed. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationSuccessfull" class="alert alert-success">
|
||||
<p>{% trans "Installation successful. Visit:" %} {$ installationURL $}</p>
|
||||
<p>{% trans "Installation successful. Visit:" %} {$ installationURL $} or perform <strong><a href="https://go.cyberpanel.net/StessTest">stress test</a></strong>.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
class="btn btn-border btn-alt border-azure btn-link font-azure"
|
||||
href="/websites/{{ domain }}/{{ childDomain }}/syncToMaster"
|
||||
title=""><span>{% trans "Copy/Sync to Master" %}</span></a>
|
||||
<a style="float: right" class="btn btn-border btn-alt border-black btn-link font-black"
|
||||
href="https://go.cyberpanel.net/StessTest" title=""><span>{% trans "Stress Test" %}</span></a>
|
||||
</h3>
|
||||
|
||||
<div class="">
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
<a style="float: right; margin-left: 2%"
|
||||
class="btn btn-border btn-alt border-azure btn-link font-azure"
|
||||
href="/websites/{{ domain }}/setupStaging" title=""><span>{% trans "Clone/Staging" %}</span></a>
|
||||
<a style="float: right" class="btn btn-border btn-alt border-blue-alt btn-link font-blue-alt"
|
||||
<a style="float: right; margin-left: 2%" class="btn btn-border btn-alt border-blue-alt btn-link font-blue-alt"
|
||||
href="/websites/{{ domain }}/sshAccess" title=""><span>{% trans "Set up SSH Access" %}</span></a>
|
||||
<a style="float: right" class="btn btn-border btn-alt border-black btn-link font-black"
|
||||
href="https://go.cyberpanel.net/StessTest" title=""><span>{% trans "Stress Test" %}</span></a>
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
@@ -240,10 +242,10 @@
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row mx-10">
|
||||
<div class="col-md-3 panel-body">
|
||||
<a href="" ng-click="showCreateDomainForm()" title="{% trans 'Add Domains' %}" href="">
|
||||
<a href="{% url 'CreateNewDomain' %}" title="{% trans 'Add Domains' %}" href="">
|
||||
<img src="{% static 'images/icons/domains.png' %}" width="65" class="mr-10">
|
||||
</a>
|
||||
<a ng-click="showCreateDomainForm()" title="{% trans 'Add Domains' %}" href=""
|
||||
<a href="{% url 'CreateNewDomain' %}" title="{% trans 'Add Domains' %}" href=""
|
||||
title="{% trans 'Add Domains' %}">
|
||||
<span class="h4">{% trans "Add Domains" %}</span>
|
||||
</a>
|
||||
@@ -273,7 +275,7 @@
|
||||
|
||||
<div class="col-md-3 panel-body">
|
||||
<a href="{% url 'listCron' %}?domain={{ domain }}" target="_self" title="{% trans 'Add new Cron Job' %}"
|
||||
href="" title="{% trans 'List Domains' %}">
|
||||
href="" title="{% trans 'Add new Cron Job' %}">
|
||||
<img src="{% static 'images/icons/repeat.png' %}" width="65" class="mr-10">
|
||||
</a>
|
||||
<a href="{% url 'listCron' %}?domain={{ domain }}" target="_self" title="{% trans 'Add new Cron Job' %}"
|
||||
@@ -312,7 +314,6 @@
|
||||
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
|
||||
<div class="col-sm-6">
|
||||
@@ -324,7 +325,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" ng-hide="installationDetailsForm"
|
||||
class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||
@@ -356,7 +356,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
@@ -366,7 +365,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-7">
|
||||
|
||||
@@ -11,6 +11,10 @@ urlpatterns = [
|
||||
url(r'^deleteWebsite$', views.deleteWebsite, name='deleteWebsite'),
|
||||
url(r'^siteState$', views.siteState, name='siteState'),
|
||||
|
||||
##
|
||||
|
||||
url(r'^CreateNewDomain$', views.CreateNewDomain, name='CreateNewDomain'),
|
||||
|
||||
|
||||
# Website modification url
|
||||
|
||||
|
||||
@@ -46,6 +46,14 @@ def deleteWebsite(request):
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def CreateNewDomain(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager()
|
||||
return wm.CreateNewDomain(request, userID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def siteState(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
@@ -75,6 +75,12 @@ class WebsiteManager:
|
||||
{'websiteList': websitesName}, 'deleteWebsite')
|
||||
return proc.render()
|
||||
|
||||
def CreateNewDomain(self, request=None, userID=None, data=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
proc = httpProc(request, 'websiteFunctions/createDomain.html', {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions()})
|
||||
return proc.render()
|
||||
|
||||
def siteState(self, request=None, userID=None, data=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user