mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
delete non-existing site using the core function
This commit is contained in:
@@ -284,6 +284,8 @@ password=%s""" % (rootdbpassword, rootdbpassword)
|
|||||||
|
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
import validators
|
import validators
|
||||||
|
from plogical.vhost import vhost
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(1)
|
currentACL = ACLManager.loadedACL(1)
|
||||||
allSite = ACLManager.findAllSites(currentACL, 1)
|
allSite = ACLManager.findAllSites(currentACL, 1)
|
||||||
|
|
||||||
@@ -294,11 +296,7 @@ password=%s""" % (rootdbpassword, rootdbpassword)
|
|||||||
self.PostStatus(
|
self.PostStatus(
|
||||||
'Domain %s not found in Master, deleting data directories and configurations.' % (website))
|
'Domain %s not found in Master, deleting data directories and configurations.' % (website))
|
||||||
|
|
||||||
command = 'rm -rf /home/%s' % (website)
|
vhost.deleteVirtualHostConfigurations(website)
|
||||||
ProcessUtilities.normalExecutioner(command)
|
|
||||||
|
|
||||||
command = 'rm -rf /%s/%s' % (ClusterManager.vhostConfPath, website)
|
|
||||||
ProcessUtilities.normalExecutioner(command)
|
|
||||||
|
|
||||||
self.PostStatus('All domains synced.')
|
self.PostStatus('All domains synced.')
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import django
|
import django
|
||||||
|
|
||||||
|
from plogical.acl import ACLManager
|
||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
try:
|
try:
|
||||||
@@ -392,14 +395,18 @@ class vhost:
|
|||||||
if os.path.exists('/root/.acme.sh/%s' % (items.domain)):
|
if os.path.exists('/root/.acme.sh/%s' % (items.domain)):
|
||||||
shutil.rmtree('/root/.acme.sh/%s' % (items.domain))
|
shutil.rmtree('/root/.acme.sh/%s' % (items.domain))
|
||||||
|
|
||||||
for items in databases:
|
## Child check, to make sure no database entires are being deleted from child node
|
||||||
mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
|
|
||||||
|
|
||||||
delWebsite.delete()
|
if ACLManager.FindIfChild() == 0:
|
||||||
|
|
||||||
## Deleting DNS Zone if there is any.
|
for items in databases:
|
||||||
|
mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
|
||||||
|
|
||||||
DNS.deleteDNSZone(virtualHostName)
|
delWebsite.delete()
|
||||||
|
|
||||||
|
## Deleting DNS Zone if there is any.
|
||||||
|
|
||||||
|
DNS.deleteDNSZone(virtualHostName)
|
||||||
|
|
||||||
if not os.path.exists(vhost.redisConf):
|
if not os.path.exists(vhost.redisConf):
|
||||||
installUtilities.installUtilities.reStartLiteSpeed()
|
installUtilities.installUtilities.reStartLiteSpeed()
|
||||||
@@ -464,14 +471,18 @@ class vhost:
|
|||||||
numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
|
numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
|
||||||
vhost.deleteCoreConf(items.domain, numberOfSites)
|
vhost.deleteCoreConf(items.domain, numberOfSites)
|
||||||
|
|
||||||
for items in databases:
|
|
||||||
mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
|
|
||||||
|
|
||||||
delWebsite.delete()
|
## child check to make sure no database entires are being deleted from child server
|
||||||
|
|
||||||
## Deleting DNS Zone if there is any.
|
if ACLManager.FindIfChild() == 0:
|
||||||
|
for items in databases:
|
||||||
|
mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
|
||||||
|
|
||||||
DNS.deleteDNSZone(virtualHostName)
|
delWebsite.delete()
|
||||||
|
|
||||||
|
## Deleting DNS Zone if there is any.
|
||||||
|
|
||||||
|
DNS.deleteDNSZone(virtualHostName)
|
||||||
|
|
||||||
installUtilities.installUtilities.reStartLiteSpeed()
|
installUtilities.installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
|||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
import shutil
|
|
||||||
import argparse
|
import argparse
|
||||||
from plogical import installUtilities
|
from plogical import installUtilities
|
||||||
from plogical import sslUtilities
|
from plogical import sslUtilities
|
||||||
from os.path import join
|
|
||||||
from os import listdir, rmdir
|
|
||||||
from shutil import move
|
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
@@ -27,7 +22,6 @@ from plogical.mailUtilities import mailUtilities
|
|||||||
from plogical import CyberCPLogFileWriter as logging
|
from plogical import CyberCPLogFileWriter as logging
|
||||||
from plogical.dnsUtilities import DNS
|
from plogical.dnsUtilities import DNS
|
||||||
from plogical.vhost import vhost
|
from plogical.vhost import vhost
|
||||||
from plogical.applicationInstaller import ApplicationInstaller
|
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
from plogical.processUtilities import ProcessUtilities
|
from plogical.processUtilities import ProcessUtilities
|
||||||
from ApachController.ApacheController import ApacheController
|
from ApachController.ApacheController import ApacheController
|
||||||
|
|||||||
Reference in New Issue
Block a user