Date: Tue, 14 Jun 2022 17:20:12 +0500
Subject: [PATCH 2/2] backuptestfinal1
---
plogical/applicationInstaller.py | 88 +++++---
.../websiteFunctions/RestoreBackups.html | 4 +-
.../websiteFunctions/WPRestoreHome.html | 189 +++++++++---------
.../websiteFunctions/WPsiteHome.html | 144 +++++++------
websiteFunctions/tests.py | 9 +-
5 files changed, 245 insertions(+), 189 deletions(-)
diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py
index 6e0ff0256..b48b91ef4 100755
--- a/plogical/applicationInstaller.py
+++ b/plogical/applicationInstaller.py
@@ -2652,18 +2652,6 @@ $parameters = array(
newWPpath = wpsite.path
newurl = wpsite.FinalURL
- #### Check If sub dir in web site
- try:
- oldpath = config['WPsitepath']
- abc = oldpath.split("/")
- pathexta = abc[4]
- if pathexta != "":
- home = "0"
- else:
- home = "1"
- except BaseException as msg:
- home = "1"
-
### get WPsite Database name and usr
php = PHPManager.getPHPString(PhpVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
@@ -2802,20 +2790,38 @@ $parameters = array(
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
###Copy backup content to newsite
if home == "0":
+ #### Check If sub dir in New web site
+ try:
+ kl = newWPpath.split("/")
+ newpathexta = kl[4]
+ if newpathexta != "":
+ newsubdir = "0"
+ else:
+ newsubdir = "1"
+ except BaseException as msg:
+ newsubdir = "1"
+
+ if newsubdir == "0":
+ unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
+ ###first split back to publich_html then mak dir and te copy
+ b = newWPpath.rstrip('/')
+ newwebpath = b.rstrip(newpathexta)
+ command = "sudo -u %s mkdir %s%s" % (VHuser, newwebpath, pathexta)
+ ProcessUtilities.executioner(command)
+ Webnewpath = str(newwebpath) + str(pathexta)
+
+ else:
+ unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
+ ###make dir of sub folder in existing site
+ command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
+ ProcessUtilities.executioner(command)
+ Webnewpath = str(newWPpath) + str(pathexta)
+
+ else:
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
- ###make dir of sub folder in existing site
- command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
- ProcessUtilities.executioner(command)
- Webnewpath = str(newWPpath) + str(pathexta)
- else:
- unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (
- self.tempPath, oldtemppath)
Webnewpath = newWPpath
- ###/usr/local/CyberCP/tmp/1755/ab/usr/local/CyberCP/tmp/8774/public_html
- ###/usr/local/CyberCP/tmp/1755/ab/usr/local/CyberCP/tmp/8774/public_html/public_html/*
-
command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath)
result = ProcessUtilities.outputExecutioner(command)
@@ -2975,7 +2981,7 @@ $parameters = array(
newurl = wpsite.FinalURL
- #### Check If sub dir in web site
+ #### Check If sub dir in old web site
try:
oldpath = config['WPsitepath']
abc = oldpath.split("/")
@@ -2987,6 +2993,9 @@ $parameters = array(
except BaseException as msg:
home = "1"
+
+
+
### get WPsite Database name and usr
php = PHPManager.getPHPString(PhpVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
@@ -3039,14 +3048,35 @@ $parameters = array(
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
###Copy backup content to newsite
if home == "0":
+ #### Check If sub dir in New web site
+ try:
+ kl = newWPpath.split("/")
+ newpathexta = kl[4]
+ if newpathexta != "":
+ newsubdir = "0"
+ else:
+ newsubdir = "1"
+ except BaseException as msg:
+ newsubdir = "1"
+
+ if newsubdir == "0":
+ unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
+ ###first split back to publich_html then mak dir and te copy
+ b = newWPpath.rstrip('/')
+ newwebpath = b.rstrip(newpathexta)
+ command = "sudo -u %s mkdir %s%s" % (VHuser, newwebpath, pathexta)
+ ProcessUtilities.executioner(command)
+ Webnewpath = str(newwebpath) + str(pathexta)
+
+ else:
+ unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
+ ###make dir of sub folder in existing site
+ command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
+ ProcessUtilities.executioner(command)
+ Webnewpath = str(newWPpath) + str(pathexta)
- unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
- ###make dir of sub folder in existing site
- command = "sudo -u %s mkdir %s%s"%(VHuser, newWPpath, pathexta)
- ProcessUtilities.executioner(command)
- Webnewpath = str(newWPpath)+str(pathexta)
else:
- ##usr/local/CyberCP/tmp/4701/ab/usr/local/CyberCP/tmp/9507/public_html/public_html/
+
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
Webnewpath = newWPpath
diff --git a/websiteFunctions/templates/websiteFunctions/RestoreBackups.html b/websiteFunctions/templates/websiteFunctions/RestoreBackups.html
index dc510353e..c90bd0e86 100644
--- a/websiteFunctions/templates/websiteFunctions/RestoreBackups.html
+++ b/websiteFunctions/templates/websiteFunctions/RestoreBackups.html
@@ -114,9 +114,9 @@
|
-
+
{{ sub.id }}
-
+
|
{{ sub.title }}
diff --git a/websiteFunctions/templates/websiteFunctions/WPRestoreHome.html b/websiteFunctions/templates/websiteFunctions/WPRestoreHome.html
index 4a9eaf450..2a32e2def 100644
--- a/websiteFunctions/templates/websiteFunctions/WPRestoreHome.html
+++ b/websiteFunctions/templates/websiteFunctions/WPRestoreHome.html
@@ -16,112 +16,119 @@
{% trans "On this page you can Restore, list, modify and delete Backups Wordpress Sites from your server." %}
+ {{ backupobj.id }}
+ {{ Backuptype }}
- {{ FileName }}
+
+
- {{ backupobj.id }}
- {{ Backuptype }}
- {% if Backuptype == "DataBase Backup" %}
-
- Create Backup Now
-
-
-
-
-
+
-
-
-
-
diff --git a/websiteFunctions/tests.py b/websiteFunctions/tests.py
index 31d9fc814..f4e14fb88 100755
--- a/websiteFunctions/tests.py
+++ b/websiteFunctions/tests.py
@@ -1,11 +1,16 @@
-a = "/home/habibackup.ml/public_html/////"
+a = "/home/folderhabitk.ml/public_html/subfile/"
DomainName ="newweb3.com"
abc = a.split("/")
wpexpath = abc[4]
+
+
+b=a.rstrip('/')
+c= b.rstrip(wpexpath)
newpath = '/home/%s/public_html/%s' % (DomainName, wpexpath)
if wpexpath != "":
home = "0"
else:
home = "1"
-print(home)
+print(wpexpath)
+print(c)
|