backuptestfinal1

This commit is contained in:
Hassan Hashmi
2022-06-14 17:20:12 +05:00
parent bab15afeb4
commit 93de10303f
5 changed files with 245 additions and 189 deletions

View File

@@ -2652,18 +2652,6 @@ $parameters = array(
newWPpath = wpsite.path newWPpath = wpsite.path
newurl = wpsite.FinalURL 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 ### get WPsite Database name and usr
php = PHPManager.getPHPString(PhpVersion) php = PHPManager.getPHPString(PhpVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
@@ -2802,19 +2790,37 @@ $parameters = array(
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50') logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
###Copy backup content to newsite ###Copy backup content to newsite
if home == "0": 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) unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
###make dir of sub folder in existing site ###make dir of sub folder in existing site
command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta) command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
Webnewpath = str(newWPpath) + str(pathexta) 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 else:
###/usr/local/CyberCP/tmp/1755/ab/usr/local/CyberCP/tmp/8774/public_html/public_html/*
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
Webnewpath = newWPpath
command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath) command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath)
result = ProcessUtilities.outputExecutioner(command) result = ProcessUtilities.outputExecutioner(command)
@@ -2975,7 +2981,7 @@ $parameters = array(
newurl = wpsite.FinalURL newurl = wpsite.FinalURL
#### Check If sub dir in web site #### Check If sub dir in old web site
try: try:
oldpath = config['WPsitepath'] oldpath = config['WPsitepath']
abc = oldpath.split("/") abc = oldpath.split("/")
@@ -2987,6 +2993,9 @@ $parameters = array(
except BaseException as msg: except BaseException as msg:
home = "1" home = "1"
### get WPsite Database name and usr ### get WPsite Database name and usr
php = PHPManager.getPHPString(PhpVersion) php = PHPManager.getPHPString(PhpVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
@@ -3039,14 +3048,35 @@ $parameters = array(
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50') logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50')
###Copy backup content to newsite ###Copy backup content to newsite
if home == "0": 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) unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
###make dir of sub folder in existing site ###make dir of sub folder in existing site
command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta) command = "sudo -u %s mkdir %s%s" % (VHuser, newWPpath, pathexta)
ProcessUtilities.executioner(command) ProcessUtilities.executioner(command)
Webnewpath = str(newWPpath) + str(pathexta) Webnewpath = str(newWPpath) + str(pathexta)
else: 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) unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
Webnewpath = newWPpath Webnewpath = newWPpath

View File

@@ -114,9 +114,9 @@
<tr> <tr>
<td style="padding: 13px;"> <td style="padding: 13px;">
<a href="#">
<p style="font-weight: bold; text-transform: uppercase; ">{{ sub.id }}</p> <p style="font-weight: bold; text-transform: uppercase; ">{{ sub.id }}</p>
</a>
</td> </td>
<td style="padding: 13px;"> <td style="padding: 13px;">
{{ sub.title }} {{ sub.title }}

View File

@@ -16,14 +16,19 @@
</h2> </h2>
<p>{% trans "On this page you can Restore, list, modify and delete Backups Wordpress Sites from your server." %}</p> <p>{% trans "On this page you can Restore, list, modify and delete Backups Wordpress Sites from your server." %}</p>
</div> </div>
<div class="panel">
<div class="panel-body">
<h2 > {{ FileName }}</h2><img id="wordpresshomeloading" style="display: none" src="{% static 'images/loading.gif' %}">
<span id="backupid" style="display: none">{{ backupobj.id }}</span> <span id="backupid" style="display: none">{{ backupobj.id }}</span>
<span id="backuptype" style="display: none">{{ Backuptype }}</span> <span id="backuptype" style="display: none">{{ Backuptype }}</span>
<div class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{{ FileName }} <img id="wordpresshomeloading" style="display: none"
src="{% static 'images/loading.gif' %}"></h3>
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
{% if Backuptype == "DataBase Backup" %} {% if Backuptype == "DataBase Backup" %}
<div id="exinstingsitedivDB" ng-hide="installationDetailsForm" style="margin-top: 2%;" <div id="exinstingsitedivDB" ng-hide="installationDetailsForm"
class="form-group"> class="form-group">
<label class="col-sm-2 control-label">{% trans "Choose WPsite Restore Destination " %}</label> <label class="col-sm-2 control-label">{% trans "Choose WPsite Restore Destination " %}</label>
<div class="col-sm-10"> <div class="col-sm-10">
@@ -38,18 +43,18 @@
</div> </div>
</div> </div>
{% else %} {% else %}
<div ng-hide="installationDetailsForm" style="margin-top: 1%" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-2 control-label">{% trans "Choose Restronig Method " %}</label> <label class="col-sm-2 control-label">{% trans "Choose Restronig Method " %}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<select ng-click="checkmethode()" id="RestoreMethode" class="form-control" required> <select ng-click="checkmethode()" id="RestoreMethode" class="form-control" required>
<option value="-1">Selecte Methode</option> <option value="-1">Select Method</option>
<option value="1">Restore to New Site</option> <option value="1">Restore to New Site</option>
<option value="0">Restore to Existing Site</option> <option value="0">Restore to Existing Site</option>
</select> </select>
</div> </div>
</div> </div>
<div id="exinstingsitediv" ng-hide="installationDetailsForm" style="margin-top: 4%; display: none" <div id="exinstingsitediv" ng-hide="installationDetailsForm" style="display: none"
class="form-group"> class="form-group">
<label class="col-sm-2 control-label">{% trans "Choose WPsite Restore Destination " %}</label> <label class="col-sm-2 control-label">{% trans "Choose WPsite Restore Destination " %}</label>
<div class="col-sm-10"> <div class="col-sm-10">
@@ -63,25 +68,21 @@
</div> </div>
</div> </div>
<div id="Newsitediv" ng-hide="installationDetailsForm" style="margin-top: 4%; display: none" class="form-group"> <div id="Newsitediv" ng-hide="installationDetailsForm" style="display: none"
class="form-group">
<label class="col-sm-2 control-label">{% trans "Website Domain" %}</label> <label class="col-sm-2 control-label">{% trans "Website Domain" %}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input name="Newdomain" id="Newdomain" type="url" placeholder="Enter New Website Domain for Restoring Website " <input name="Newdomain" id="Newdomain" type="url"
placeholder="Enter New Website Domain for Restoring Website "
class="form-control" required> class="form-control" required>
</div> </div>
</div> </div>
{% endif %} {% endif %}
<div ng-model="installationDetailsForm" class="col-sm-12 center-div">
<div ng-model="installationDetailsForm" class="col-sm-12 center-div" style="margin-top: 7%">
<button id="RestoreWPbackupNow" type="button" <button id="RestoreWPbackupNow" type="button"
ng-click="RestoreWPbackupNow()" ng-click="RestoreWPbackupNow()"
class="btn btn-primary btn-lg center-div">{% trans "Restore Backup Now" %}</button> class="btn btn-primary btn-lg center-div">{% trans "Restore Backup Now" %}</button>
</div> </div>
<div style="margin-top: 1%" ng-hide="installationProgress" class="form-group"> <div style="margin-top: 1%" ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label> <label class="col-sm-2 control-label"></label>
<div class="col-sm-7"> <div class="col-sm-7">
@@ -122,6 +123,12 @@
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button> class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div> </div>
</div> </div>
</form>
</div>
</div> </div>
</div> </div>

View File

@@ -419,25 +419,35 @@
</div> </div>
<div class="tab-pane" id="tab5"> <div class="tab-pane" id="tab5">
<h2>Create Backup Now</h2> <div class="panel-body">
<div class="col-sm-12" style="margin-top: 1%"> <h3 class="content-box-header">
<div class="col-sm-12"> {% trans "Create Backup " %}
<label class="col-sm-3 control-label">{% trans "Select Backip type" %}</label> </h3>
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Backup type" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">
<select id="backuptype" class="form-control"> <select id="backuptype" class="form-control">
<option value="1">Website and DataBase Both</option> <option value="1">Website and Database Both</option>
<option value="2">Only Website Data</option> <option value="2">Only Website Data</option>
<option value="3">Only DataBase</option> <option value="3">Only Database</option>
</select> </select>
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" id="createbackupbutton"
ng-click="CreateBackup()"
class="btn btn-primary btn-lg">{% trans "Create Backup" %}</button>
</div> </div>
</div> </div>
<div class="col-sm-12 center-div" style="margin-top: 4%"> <div style="margin-top: 1%" ng-hide="installationProgress"
<button id="createbackupbutton" type="button" class="form-group">
ng-click="CreateBackup()"
class="btn btn-primary btn-lg center-div">{% trans "Create Backup" %}</button>
</div>
<div style="margin-top: 1%" ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label> <label class="col-sm-2 control-label"></label>
<div class="col-sm-7"> <div class="col-sm-7">
@@ -477,10 +487,14 @@
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button> class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div>
<hr> <hr>
<div class="d-lg-flex d-none justify-content-center"> <div class="d-lg-flex d-none justify-content-center">
<a href="/websites/{{ wpsite.owner.domain }}"> <a href="/websites/{{ wpsite.owner.domain }}">

View File

@@ -1,11 +1,16 @@
a = "/home/habibackup.ml/public_html/////" a = "/home/folderhabitk.ml/public_html/subfile/"
DomainName ="newweb3.com" DomainName ="newweb3.com"
abc = a.split("/") abc = a.split("/")
wpexpath = abc[4] wpexpath = abc[4]
b=a.rstrip('/')
c= b.rstrip(wpexpath)
newpath = '/home/%s/public_html/%s' % (DomainName, wpexpath) newpath = '/home/%s/public_html/%s' % (DomainName, wpexpath)
if wpexpath != "": if wpexpath != "":
home = "0" home = "0"
else: else:
home = "1" home = "1"
print(home) print(wpexpath)
print(c)