Test_Domain_Complete

This commit is contained in:
jojkhan
2022-11-17 13:58:46 +05:00
parent 33db7dc472
commit 18d38083e9
6 changed files with 702 additions and 246 deletions

View File

@@ -507,6 +507,29 @@ function DeployToProductionInitial(vall) {
DeploytoProductionID = vall;
}
var create_staging_domain_check = 0;
function create_staging_checkbox_function() {
var checkBox = document.getElementById("Create_Staging_Check");
// Get the output text
// If the checkbox is checked, display the output text
if (checkBox.checked == true) {
create_staging_domain_check = 0;
document.getElementById('Website_Create_Test_Domain').style.display = "block";
document.getElementById('Website_Create_Own_Domain').style.display = "none";
} else {
document.getElementById('Website_Create_Test_Domain').style.display = "none";
document.getElementById('Website_Create_Own_Domain').style.display = "block";
create_staging_domain_check = 1;
}
// alert(domain_check);
}
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
var CheckBoxpasssword = 0;
@@ -1187,9 +1210,19 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
$scope.currentStatus = "Starting creation Staging..";
//here enter domain name
if (create_staging_domain_check == 0) {
var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value;
var domainNameCreate = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate;
}
if (create_staging_domain_check == 1) {
var domainNameCreate = $scope.own_domainNameCreate;
}
var data = {
StagingName: $('#stagingName').val(),
StagingDomain: $('#stagingDomain').val(),
StagingDomain: domainNameCreate,
WPid: $('#WPid').html(),
}
var url = "/websites/CreateStagingNow";
@@ -2347,6 +2380,7 @@ function website_create_checkbox_function() {
// alert(domain_check);
}
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
$scope.webSiteCreationLoading = true;
@@ -3380,6 +3414,28 @@ app.controller('modifyWebsitesController', function ($scope, $http) {
/* Java script code to create account */
var website_child_domain_check = 0;
function website_child_domain_checkbox_function() {
var checkBox = document.getElementById("myCheck");
// Get the output text
// If the checkbox is checked, display the output text
if (checkBox.checked == true) {
website_child_domain_check = 0;
document.getElementById('Website_Create_Test_Domain').style.display = "block";
document.getElementById('Website_Create_Own_Domain').style.display = "none";
} else {
document.getElementById('Website_Create_Test_Domain').style.display = "none";
document.getElementById('Website_Create_Own_Domain').style.display = "block";
website_child_domain_check = 1;
}
// alert(domain_check);
}
app.controller('websitePages', function ($scope, $http, $timeout, $window) {
@@ -4484,6 +4540,16 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
if (typeof path === 'undefined') {
path = "";
}
var package = $scope.packageForWebsite;
if (website_child_domain_check == 0) {
var Part2_domainNameCreate = document.getElementById('Part2_domainNameCreate').value;
var domainName = document.getElementById('TestDomainNameCreate').value + Part2_domainNameCreate;
}
if (website_child_domain_check == 1) {
var domainName = $scope.own_domainNameCreate;
}
var data = {

View File

@@ -65,8 +65,13 @@
.help_test_domain {
background-color: black;
padding: 3px;
padding: 10px;
display: none;
opacity: 0.7;
position: absolute;
z-index: 9;
text-align: justify;
}
@@ -78,7 +83,8 @@
font-size: small;
border-radius: 5px;
width: 200px;
height: auto;
{#height: auto;#}
}
</style>
@@ -161,8 +167,8 @@
</label>
<label class="help_test_domain">
Hello World!! Hello World!! Hello World!! Hello World!! Hello World!!Hello World!! Hello World!!git
The test domain allows you to deploy websites without the need to add DNS records, it
allows you to create staging environments, deploy test websites, and much more...
</label>
@@ -170,7 +176,7 @@
<br><br>
<div id="Test_Domain" class="tabcontent" style="border: none;margin-left: 10px">
<div id="Test_Domain" class="tabcontent" style="border: none;margin-left: 10px; position: relative">
<div ng-hide="installationDetailsForm" class="form-group"
ng-if="{{ test_domain_data }} == 1 ">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
@@ -206,7 +212,7 @@
</div>
<div id="Own_Domain" class="tabcontent"
style="border: none;display: none;margin-left: 10px">
style="border: none;display: none;margin-left: 10px;position: relative">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>

View File

@@ -7,6 +7,92 @@
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.switch {
margin-top: 7px;
margin-left: 12px;
position: relative;
display: inline-block;
width: 32px;
height: 19px;
border-radius: 10%;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 10%;
}
.slider:before {
position: absolute;
content: "";
height: 11px;
width: 12px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 20%;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 2px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(12px);
-ms-transform: translateX(12px);
transform: translateX(12px);
}
.help_test_domain {
background-color: black;
padding: 10px;
display: none;
opacity: 0.7;
position: absolute;
z-index: 9;
text-align: justify;
}
#help:hover + .help_test_domain {
display: block;
display: inline-block;
color: white;
font-weight: lighter;
font-size: small;
border-radius: 5px;
width: 200px;
{#height: auto;#}
}
</style>
<div style="display: none" id="wordpresshome"></div>
<div style="display: none" id="WPid">{{ wpsite.id }}</div>
@@ -304,17 +390,107 @@
type="text" class="form-control" id="stagingName">
</div>
</div>
<div ng-hide="stagingDetailsForm" class="form-group mt-5">
<label style="margin-bottom: 2%!important;"
class="col-sm-2 control-label">Domain Name</label>
<div ng-hide="stagingDetailsForm" class="form-group">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label" style="margin-top: 10px"
style="margin-bottom: 15px">{% trans "Test Domain" %}</label>
<label class="switch ">
<input type="checkbox" checked id="Create_Staging_Check"
onclick="create_staging_checkbox_function()"
style="margin-top: 10px">
<span class="slider"></span>
</label>
<label id="help">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25"
style="padding-top: 10px"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="currentColor"
d="M12 6a3.939 3.939 0 0 0-3.934 3.934h2C10.066 8.867 10.934 8 12 8s1.934.867 1.934 1.934c0 .598-.481 1.032-1.216 1.626a9.208 9.208 0 0 0-.691.599c-.998.997-1.027 2.056-1.027 2.174V15h2l-.001-.633c.001-.016.033-.386.441-.793c.15-.15.339-.3.535-.458c.779-.631 1.958-1.584 1.958-3.182A3.937 3.937 0 0 0 12 6zm-1 10h2v2h-2z"/>
<path fill="currentColor"
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10s10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8s8 3.589 8 8s-3.589 8-8 8z"/>
</svg>
</label>
<label class="help_test_domain">
The test domain allows you to deploy websites without the need to add DNS
records, it
allows you to create staging environments, deploy test websites, and much
more...
</label>
<br><br>
<div id="Website_Create_Test_Domain" class="tabcontent"
style="border: none">
<div ng-hide="installationDetailsForm" class="form-group"
ng-if="{{ test_domain_data }} == 1 ">
<label class="col-sm-2 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-10">
<input style="margin-bottom: 2%!important;"
type="text" class="form-control" id="stagingDomain">
<div class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input id="TestDomainNameCreate"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Enter Subdomain Here" %}">
<span style="width: 48%" class="input-group-btn">
<input id="Part2_domainNameCreate" class="form-control"
type="text" name="Part2_domainNameCreate"
style="display: block;color: black;font-weight: bold;color: black;opacity: 1"
placeholder=".{{ Randam_String }}.cyberpanel.website"
value=".{{ Randam_String }}.cyberpanel.website" readonly></span>
</div>
</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-if="{{ test_domain_data }} == 0 ">
<center>Looks like you have not subscripted to temporary domain feature,
<a
href="https://go.cyberpanel.net/TempDomain">click here</a>
for more details.
</center>
</div>
</div>
<div id="Website_Create_Own_Domain" class="tabcontent"
style="border: none;display: none">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-10">
<div class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input ng-model="own_domainNameCreate" id="touchspin-demo-1"
class="col-sm-10 form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}">
<span style="width: 25%" class="input-group-btn">
</span></div>
</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>
</div>
</div>
{# end my work#}
<div ng-hide="stagingDetailsForm" class="center-div mt-5 " >
<button ng-click="CreateStagingNow()"
style="margin-bottom: 2%!important;"
style="margin-bottom: 2%!important;margin-top: 50px"
class="btn btn-alt btn-hover btn-blue-alt">
<span>Create Now</span>
<i class="glyph-icon icon-arrow-right"></i>

View File

@@ -7,6 +7,90 @@
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.switch {
margin-top: 7px;
margin-left: 12px;
position: relative;
display: inline-block;
width: 32px;
height: 19px;
border-radius: 10%;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
border-radius: 10%;
}
.slider:before {
position: absolute;
content: "";
height: 11px;
width: 12px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
border-radius: 20%;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 2px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(12px);
-ms-transform: translateX(12px);
transform: translateX(12px);
}
.help_test_domain {
background-color: black;
padding: 10px;
display: none;
opacity: 0.7;
position: absolute;
z-index: 9;
text-align: justify;
}
#help:hover + .help_test_domain {
display: block;
display: inline-block;
color: white;
font-weight: lighter;
font-size: small;
border-radius: 5px;
width: 200px;
{#height: auto;#}
}
</style>
<div class="container">
<div id="page-title">
<h2>{% trans "Create Child Domain" %}</h2>
@@ -36,16 +120,119 @@
</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>#}
{# My Work . #}
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label"
style="margin-bottom: 15px">{% trans "Test Domain" %}</label>
<label class="switch my-3">
<input type="checkbox" checked id="myCheck"
onclick="website_child_domain_checkbox_function()"
style="margin-top: 10px">
<span class="slider"></span>
</label>
<label id="help">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" style="padding-top: 10px"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="currentColor"
d="M12 6a3.939 3.939 0 0 0-3.934 3.934h2C10.066 8.867 10.934 8 12 8s1.934.867 1.934 1.934c0 .598-.481 1.032-1.216 1.626a9.208 9.208 0 0 0-.691.599c-.998.997-1.027 2.056-1.027 2.174V15h2l-.001-.633c.001-.016.033-.386.441-.793c.15-.15.339-.3.535-.458c.779-.631 1.958-1.584 1.958-3.182A3.937 3.937 0 0 0 12 6zm-1 10h2v2h-2z"/>
<path fill="currentColor"
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10s10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8s8 3.589 8 8s-3.589 8-8 8z"/>
</svg>
</label>
<label class="help_test_domain">
The test domain allows you to deploy websites without the need to add DNS records, it
allows you to create staging environments, deploy test websites, and much more...
</label>
<br><br>
<div id="Website_Create_Test_Domain" class="tabcontent"
style="border: none;margin-left: 10px">
<div ng-hide="DomainCreateForm" class="form-group"
ng-if="{{ test_domain_data }} == 1 ">
<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 class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input id="TestDomainNameCreate"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Enter Subdomain Here" %}">
<span style="width: 48%" class="input-group-btn">
<input id="Part2_domainNameCreate" class="form-control"
type="text" name="Part2_domainNameCreate"
style="display: block;color: black;font-weight: bold;color: black;opacity: 1"
placeholder=".{{ Randam_String }}.cyberpanel.website"
value=".{{ Randam_String }}.cyberpanel.website" readonly></span>
</div>
</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-if="{{ test_domain_data }} == 0 ">
<center>Looks like you have not subscripted to temporary domain feature, <a
href="https://go.cyberpanel.net/TempDomain">click here</a>
for more details.
</center>
</div>
</div>
<div id="Website_Create_Own_Domain" class="tabcontent"
style="border: none;display: none;margin-left: 10px">
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Path" %}: /home/{$ masterDomain $}/ </label>
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<div class="input-group bootstrap-touchspin">
<span
class="input-group-addon bootstrap-touchspin-prefix"
style="display: none;"></span>
<input ng-model="own_domainNameCreate" id="touchspin-demo-1"
class="form-control"
type="text" value=""
name="touchspin-demo-1"
style="display: block;"
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}">
<span style="width: 25%" class="input-group-btn">
</span></div>
</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>
</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>
@@ -53,6 +240,8 @@
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
{# My Work End #}
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
<div class="col-sm-6">

View File

@@ -64,6 +64,30 @@
transform: translateX(12px);
}
.help_test_domain {
background-color: black;
padding: 10px;
display: none;
opacity: 0.7;
position: absolute;
z-index: 9;
text-align: justify;
}
#help:hover + .help_test_domain {
display: block;
display: inline-block;
color: white;
font-weight: lighter;
font-size: small;
border-radius: 5px;
width: 200px;
{#height: auto;#}
}
</style>
<div class="container">
@@ -115,6 +139,22 @@
style="margin-top: 10px">
<span class="slider"></span>
</label>
<label id="help">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" style="padding-top: 10px"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="currentColor"
d="M12 6a3.939 3.939 0 0 0-3.934 3.934h2C10.066 8.867 10.934 8 12 8s1.934.867 1.934 1.934c0 .598-.481 1.032-1.216 1.626a9.208 9.208 0 0 0-.691.599c-.998.997-1.027 2.056-1.027 2.174V15h2l-.001-.633c.001-.016.033-.386.441-.793c.15-.15.339-.3.535-.458c.779-.631 1.958-1.584 1.958-3.182A3.937 3.937 0 0 0 12 6zm-1 10h2v2h-2z"/>
<path fill="currentColor"
d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10s10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8s8 3.589 8 8s-3.589 8-8 8z"/>
</svg>
</label>
<label class="help_test_domain">
The test domain allows you to deploy websites without the need to add DNS records, it
allows you to create staging environments, deploy test websites, and much more...
</label>
<br><br>

View File

@@ -14,7 +14,8 @@ django.setup()
import json
from plogical.acl import ACLManager
import plogical.CyberCPLogFileWriter as logging
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins, WPSites, WPStaging, WPSitesBackup, RemoteBackupConfig,RemoteBackupSchedule, RemoteBackupsites
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins, WPSites, WPStaging, WPSitesBackup, \
RemoteBackupConfig, RemoteBackupSchedule, RemoteBackupsites
from plogical.virtualHostUtilities import virtualHostUtilities
import subprocess
import shlex
@@ -70,7 +71,8 @@ class WebsiteManager:
rnpss = randomPassword.generate_pass(10)
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'Randam_String': rnpss.lower(),
'test_domain_data': test_domain_status}
proc = httpProc(request, 'websiteFunctions/createWebsite.html',
Data, 'createWebsite')
return proc.render()
@@ -90,9 +92,6 @@ class WebsiteManager:
response = requests.post(url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
import requests
response = requests.post(url, data=json.dumps(data))
Status = response.json()['status']
@@ -106,7 +105,8 @@ class WebsiteManager:
counter = 0
try:
import requests
WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)['offers']
WPVersions = json.loads(requests.get('https://api.wordpress.org/core/version-check/1.7/').text)[
'offers']
for versions in WPVersions:
if counter == 7:
@@ -120,7 +120,8 @@ class WebsiteManager:
Plugins = wpplugins.objects.filter(owner=userobj)
rnpss = randomPassword.generate_pass(10)
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions, 'Plugins': Plugins,'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions,
'Plugins': Plugins, 'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
Data, 'createWebsite')
return proc.render()
@@ -180,6 +181,22 @@ class WebsiteManager:
response = requests.post(url, data=json.dumps(data))
Status = response.json()['status']
test_domain_url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(test_domain_url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
Data['test_domain_data'] = test_domain_status
rnpss = randomPassword.generate_pass(10)
Data['Randam_String'] = rnpss.lower()
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
Data['wpsite'] = WPobj
@@ -281,7 +298,6 @@ class WebsiteManager:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def BackupfileConfig(self, request=None, userID=None, RemoteConfigID=None, DeleteID=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
@@ -318,7 +334,6 @@ class WebsiteManager:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def AddRemoteBackupsite(self, request=None, userID=None, RemoteScheduleID=None, DeleteSiteID=None):
Data = {}
currentACL = ACLManager.loadedACL(userID)
@@ -354,7 +369,6 @@ class WebsiteManager:
from django.shortcuts import reverse
return redirect(reverse('pricing'))
def WordpressPricing(self, request=None, userID=None, ):
Data = {}
proc = httpProc(request, 'websiteFunctions/CyberpanelPricing.html', Data, 'createWebsite')
@@ -389,7 +403,6 @@ class WebsiteManager:
DeleteIDobj = WPSitesBackup.objects.get(pk=DeleteID)
if ACLManager.CheckIPBackupObjectOwner(currentACL, DeleteIDobj, admin) == 1:
config = DeleteIDobj.config
conf = json.loads(config)
FileName = conf['name']
@@ -416,7 +429,6 @@ class WebsiteManager:
except:
Backuptype = "Backup type not exists"
Data['job'].append({
'id': sub.id,
'title': web,
@@ -424,7 +436,6 @@ class WebsiteManager:
'BackupDestination': BackupDestination
})
proc = httpProc(request, 'websiteFunctions/RestoreBackups.html',
Data, 'createWebsite')
return proc.render()
@@ -463,10 +474,12 @@ class WebsiteManager:
password = randomPassword.generate_pass(10)
command = 'sudo -u %s wp user create autologin %s --role=administrator --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path)
command = 'sudo -u %s wp user create autologin %s --role=administrator --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (
WPobj.owner.externalApp, 'autologin@cloudpages.cloud', password, WPobj.path)
ProcessUtilities.executioner(command)
command = 'sudo -u %s wp user update autologin --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (WPobj.owner.externalApp, password, WPobj.path)
command = 'sudo -u %s wp user update autologin --user_pass="%s" --path=%s --skip-plugins --skip-themes' % (
WPobj.owner.externalApp, password, WPobj.path)
ProcessUtilities.executioner(command)
data = {}
@@ -493,7 +506,6 @@ class WebsiteManager:
currentACL = ACLManager.loadedACL(userID)
userobj = Administrator.objects.get(pk=userID)
Selectedplugins = wpplugins.objects.filter(owner=userobj)
# data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
@@ -520,8 +532,6 @@ class WebsiteManager:
return redirect(reverse('pricing'))
def SearchOnkeyupPlugin(self, userID=None, data=None):
try:
if ACLManager.CheckForPremFeature('wp-manager'):
@@ -530,7 +540,8 @@ class WebsiteManager:
pluginname = data['pluginname']
# logging.CyberCPLogFileWriter.writeToFile("Plugin Name ....... %s"%pluginname)
url = "http://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[search]=%s" % str(pluginname)
url = "http://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[search]=%s" % str(
pluginname)
import requests
res = requests.get(url)
@@ -564,7 +575,6 @@ class WebsiteManager:
# logging.CyberCPLogFileWriter.writeToFile("config ....... %s"%config)
# logging.CyberCPLogFileWriter.writeToFile(" Name ....... %s"%Name)
addpl = wpplugins(Name=Name, config=json.dumps(config), owner=userobj)
addpl.save()
@@ -594,7 +604,6 @@ class WebsiteManager:
Data['pluginbID'] = pluginbID
Data['BucketName'] = pluginobj.Name
proc = httpProc(request, 'websiteFunctions/WPEidtPlugin.html',
Data, 'createWebsite')
return proc.render()
@@ -665,7 +674,6 @@ class WebsiteManager:
pObj.config = json.dumps(ab)
pObj.save()
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
@@ -694,8 +702,21 @@ class WebsiteManager:
def CreateNewDomain(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
websitesName = ACLManager.findAllSites(currentACL, userID)
test_domain_url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(test_domain_url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
rnpss = randomPassword.generate_pass(10)
proc = httpProc(request, 'websiteFunctions/createDomain.html',
{'websiteList': websitesName, 'phps': PHPManager.findPHPVersions()})
{'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, 'test_domain_data':test_domain_status})
return proc.render()
def siteState(self, request=None, userID=None, data=None):
@@ -783,13 +804,13 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
version = html.escape(version)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
lscachee = ProcessUtilities.outputExecutioner(command)
if lscachee.find('Status: Active') > -1:
@@ -797,8 +818,8 @@ class WebsiteManager:
else:
lscache = 0
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp config list --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdout = ProcessUtilities.outputExecutioner(command)
debugging = 0
for items in stdout.split('\n'):
@@ -806,13 +827,13 @@ class WebsiteManager:
debugging = 1
break
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp option get blog_public --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp option get blog_public --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
searchindex = int(stdoutput.splitlines()[-1])
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode status --skip-plugins --skip-themes --path=%s' %(Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode status --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, path)
maintenanceMod = ProcessUtilities.outputExecutioner(command)
result = maintenanceMod.splitlines()[-1]
@@ -821,7 +842,6 @@ class WebsiteManager:
else:
maintenanceMode = 1
##### Check passwd protection
vhostName = wpsite.owner.domain
vhostPassDir = f'/home/{vhostName}'
@@ -831,7 +851,6 @@ class WebsiteManager:
else:
passwd = 0
#### Check WP cron
command = "sudo -u %s cat %s/wp-config.php" % (Vhuser, wpsite.path)
stdout = ProcessUtilities.outputExecutioner(command)
@@ -884,11 +903,11 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin list --skip-plugins --skip-themes --format=json --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'plugins': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -922,13 +941,11 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme list --skip-plugins --skip-themes --format=json --path=%s' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp theme list --skip-plugins --skip-themes --format=json --path=%s' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
json_data = stdoutput.splitlines()[-1]
data_ret = {'status': 1, 'error_message': 'None', 'themes': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -955,10 +972,8 @@ class WebsiteManager:
from plogical.phpUtilities import phpUtilities
json_data = phpUtilities.GetStagingInJson(wpsite.wpstaging_set.all().order_by('-id'))
data_ret = {'status': 1, 'error_message': 'None', 'wpsites': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1019,7 +1034,8 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
data_ret = {'status': 1, 'error_message': 'None', "DataBaseUser": DataBaseUser, "DataBaseName": DataBaseName, 'tableprefix': tableprefix}
data_ret = {'status': 1, 'error_message': 'None', "DataBaseUser": DataBaseUser,
"DataBaseName": DataBaseName, 'tableprefix': tableprefix}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1117,7 +1133,6 @@ class WebsiteManager:
wpsite = WPSites.objects.get(pk=WPManagerID)
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
pass
else:
@@ -1129,7 +1144,6 @@ class WebsiteManager:
extraArgs['Backuptype'] = Backuptype
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
background = ApplicationInstaller('WPCreateBackup', extraArgs)
background.start()
@@ -1154,7 +1168,6 @@ class WebsiteManager:
backupid = data['backupid']
DesSiteID = data['DesSite']
# try:
#
# bwp = WPSites.objects.get(pk=int(backupid))
@@ -1173,10 +1186,8 @@ class WebsiteManager:
# else:
# return ACLManager.loadError()
Domain = data['Domain']
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['backupid'] = backupid
@@ -1186,7 +1197,6 @@ class WebsiteManager:
extraArgs['home'] = data['home']
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
background = ApplicationInstaller('RestoreWPbackupNow', extraArgs)
background.start()
@@ -1202,8 +1212,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def SaveBackupConfig(self, userID=None, data=None):
try:
@@ -1248,12 +1256,9 @@ class WebsiteManager:
}
mkobj = RemoteBackupConfig(owner=admin, configtype=ConfigType, config=json.dumps(config))
mkobj.save()
time.sleep(1)
data_ret = {'status': 1, 'error_message': 'None', }
@@ -1265,7 +1270,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def SaveBackupSchedule(self, userID=None, data=None):
try:
@@ -1277,7 +1281,6 @@ class WebsiteManager:
RemoteConfigID = data['RemoteConfigID']
BackupType = data['BackupType']
RemoteBackupConfigobj = RemoteBackupConfig.objects.get(pk=RemoteConfigID)
Rconfig = json.loads(RemoteBackupConfigobj.config)
provider = Rconfig['Provider']
@@ -1318,7 +1321,8 @@ class WebsiteManager:
}
svobj = RemoteBackupSchedule(RemoteBackupConfig=RemoteBackupConfigobj, Name=ScheduleName,
timeintervel=Backfrequency, fileretention=FileRetention, config=json.dumps(config),
timeintervel=Backfrequency, fileretention=FileRetention,
config=json.dumps(config),
lastrun=str(time.time()))
svobj.save()
@@ -1331,7 +1335,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def AddWPsiteforRemoteBackup(self, userID=None, data=None):
try:
@@ -1377,7 +1380,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdateRemoteschedules(self, userID=None, data=None):
try:
@@ -1401,7 +1403,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def ScanWordpressSite(self, userID=None, data=None):
try:
@@ -1443,9 +1444,6 @@ class WebsiteManager:
ThemeUpdates="Enabled", )
wpobj.save()
data_ret = {'status': 1, 'error_message': 'None', }
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1455,8 +1453,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def installwpcore(self, userID=None, data=None):
try:
@@ -1492,7 +1488,6 @@ class WebsiteManager:
command = f"sudo -u {Vhuser} {FinalPHPPath} -d error_reporting=0 /usr/bin/wp core download --force --skip-content --version={version} --path={path}"
output = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', 'result': output}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1502,7 +1497,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def dataintegrity(self, userID=None, data=None):
try:
@@ -1533,7 +1527,6 @@ class WebsiteManager:
Vhuser, FinalPHPPath, path)
result = ProcessUtilities.outputExecutioner(command)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', 'result': result}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1579,10 +1572,8 @@ class WebsiteManager:
background = ApplicationInstaller('UpdateWPPlugin', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1599,7 +1590,6 @@ class WebsiteManager:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPManagerID = data['WPid']
Theme = data['Theme']
Themearray = data['Themearray']
@@ -1619,8 +1609,6 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
@@ -1634,7 +1622,6 @@ class WebsiteManager:
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1681,7 +1668,6 @@ class WebsiteManager:
background = ApplicationInstaller('DeletePlugins', extraArgs)
background.start()
time.sleep(2)
data_ret = {'status': 1, 'error_message': 'None'}
@@ -1718,8 +1704,6 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
@@ -1728,12 +1712,9 @@ class WebsiteManager:
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('DeleteThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1768,23 +1749,23 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if stdoutput.find('Status: Active') > -1:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate %s --skip-plugins --skip-themes --path=%s' % (Vhuser, FinalPHPPath, plugin, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate %s --skip-plugins --skip-themes --path=%s' % (
Vhuser, FinalPHPPath, plugin, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
time.sleep(3)
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1819,8 +1800,6 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
extraArgs = {}
extraArgs['adminID'] = admin.pk
extraArgs['Theme'] = Theme
@@ -1828,14 +1807,9 @@ class WebsiteManager:
extraArgs['path'] = path
extraArgs['Vhuser'] = Vhuser
background = ApplicationInstaller('ChangeStatusThemes', extraArgs)
background.start()
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1865,6 +1839,11 @@ class WebsiteManager:
else:
return ACLManager.loadError()
background = ApplicationInstaller('CreateStagingNow', extraArgs)
background.start()
@@ -1912,29 +1891,31 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
if setting == 'lscache':
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin install litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin install litespeed-cache --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin activate litespeed-cache --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --path=%s --skip-plugins --skip-themes' % (Vhuser, FinalPHPPath, path)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin deactivate litespeed-cache --path=%s --skip-plugins --skip-themes' % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'debugging':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG true --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk true 1 output:" + str(stdoutput))
@@ -1945,7 +1926,8 @@ class WebsiteManager:
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG false --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp config set WP_DEBUG false --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
logging.CyberCPLogFileWriter.writeToFile("Debugging mk false 0 output:" + str(stdoutput))
@@ -1955,30 +1937,36 @@ class WebsiteManager:
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
elif setting == 'searchIndex':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 1 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 1 --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 0 --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp option update blog_public 0 --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'maintenanceMode':
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp litespeed-purge all --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
if settingValue:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode activate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode activate --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
else:
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --path=%s --skip-plugins --skip-themes" % (Vhuser, FinalPHPPath, path)
command = "sudo -u %s %s -d error_reporting=0 /usr/bin/wp maintenance-mode deactivate --path=%s --skip-plugins --skip-themes" % (
Vhuser, FinalPHPPath, path)
stdoutput = ProcessUtilities.outputExecutioner(command)
elif setting == 'PasswordProtection':
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
@@ -2029,7 +2017,6 @@ class WebsiteManager:
logging.CyberCPLogFileWriter.writeToFile("Debugging output:" + str(stdout))
data_ret = {'status': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -2047,26 +2034,6 @@ class WebsiteManager:
if data['domain'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['domain']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
domain_status = response.json()['status']
if domain_status == 0:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
extraArgs = {}
extraArgs['currentACL'] = currentACL
extraArgs['adminID'] = admin.pk
@@ -2158,7 +2125,6 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
if not validators.email(adminEmail) or adminEmail.find('--') > -1:
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid email."}
json_data = json.dumps(data_ret)
@@ -2235,6 +2201,24 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
if data['domainName'].find("cyberpanel.website") > -1:
url = "https://platform.cyberpersons.com/CyberpanelAdOns/CreateDomain"
domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
"domain": data['domainName']
}
import requests
response = requests.post(url, data=json.dumps(domain_data))
domain_status = response.json()['status']
if domain_status == 0:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': response.json()['error_message']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
if ACLManager.checkOwnership(masterDomain, admin, currentACL) == 1:
pass
else:
@@ -2509,7 +2493,6 @@ class WebsiteManager:
import requests
response = requests.post(url, data=json.dumps(domain_data))
currentACL = ACLManager.loadedACL(userID)
if ACLManager.currentContextPermission(currentACL, 'deleteWebsite') == 0:
return ACLManager.loadErrorJson('websiteDeleteStatus', 0)
@@ -2556,9 +2539,6 @@ class WebsiteManager:
admin = Administrator.objects.get(pk=userID)
websiteName = data['websiteName']
try:
DeleteDocRoot = int(data['DeleteDocRoot'])
except:
@@ -4861,7 +4841,6 @@ StrictHostKeyChecking no
website = Websites.objects.get(domain=self.domain)
folders = ['/home/%s/public_html' % (self.domain)]
databases = website.databases_set.all()
# for database in databases: