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,20 +2790,38 @@ $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)
###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) 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 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) 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)
###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: 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,112 +16,119 @@
</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>
<span id="backupid" style="display: none">{{ backupobj.id }}</span>
<span id="backuptype" style="display: none">{{ Backuptype }}</span>
<div class="panel"> <div class="panel">
<div class="panel-body"> <div class="panel-body">
<h2 > {{ FileName }}</h2><img id="wordpresshomeloading" style="display: none" src="{% static 'images/loading.gif' %}"> <h3 class="content-box-header">
{{ FileName }} <img id="wordpresshomeloading" style="display: none"
src="{% static 'images/loading.gif' %}"></h3>
<div class="example-box-wrapper">
<span id="backupid" style="display: none">{{ backupobj.id }}</span> <form name="websiteCreationForm" action="/" id="createPackages"
<span id="backuptype" style="display: none">{{ Backuptype }}</span> 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">
<select id="DesSite" class="form-control" required> <select id="DesSite" class="form-control" required>
<option value="-1">Select WordPress Site</option> <option value="-1">Select WordPress Site</option>
{% for i in WPsites %} {% for i in WPsites %}
<option value="{{ i.id }}">{{ i.FinalURL }}</option> <option value="{{ i.id }}">{{ i.FinalURL }}</option>
{% endfor %} {% endfor %}
</select> </select>
</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">
<select id="DesSite" class="form-control" required> <select id="DesSite" class="form-control" required>
<option value="-1">Select WordPress Site</option> <option value="-1">Select WordPress Site</option>
{% for i in WPsites %} {% for i in WPsites %}
<option value="{{ i.id }}">{{ i.FinalURL }}</option> <option value="{{ i.id }}">{{ i.FinalURL }}</option>
{% endfor %} {% endfor %}
</select> </select>
</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"
<label class="col-sm-2 control-label">{% trans "Website Domain" %}</label> class="form-group">
<div class="col-sm-10"> <label class="col-sm-2 control-label">{% trans "Website Domain" %}</label>
<input name="Newdomain" id="Newdomain" type="url" placeholder="Enter New Website Domain for Restoring Website " <div class="col-sm-10">
class="form-control" required> <input name="Newdomain" id="Newdomain" type="url"
</div> placeholder="Enter New Website Domain for Restoring Website "
</div> class="form-control" required>
{% endif %} </div>
</div>
{% endif %}
<div ng-model="installationDetailsForm" class="col-sm-12 center-div">
<button id="RestoreWPbackupNow" type="button"
<div ng-model="installationDetailsForm" class="col-sm-12 center-div" style="margin-top: 7%"> ng-click="RestoreWPbackupNow()"
<button id="RestoreWPbackupNow" type="button" class="btn btn-primary btn-lg center-div">{% trans "Restore Backup Now" %}</button>
ng-click="RestoreWPbackupNow()"
class="btn btn-primary btn-lg center-div">{% trans "Restore Backup Now" %}</button>
</div>
<div style="margin-top: 1%" 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>
<div style="margin-top: 1%" ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">
<div class="progress"> <div class="alert alert-success text-center">
<div id="installProgressbackup" class="progress-bar" <h2>{$ currentStatus $}</h2>
role="progressbar" aria-valuenow="70" </div>
aria-valuemin="0" aria-valuemax="100"
style="width:0%"> <div class="progress">
<span class="sr-only">70% Complete</span> <div id="installProgressbackup" 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 "Backup 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 center-div">
<div class="col-sm-12">
<button type="button" ng-disabled="goBackDisable"
ng-click="goBack()"
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div> </div>
</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"> </form>
<p>{% trans "Backup 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 center-div">
<div class="col-sm-12">
<button type="button" ng-disabled="goBackDisable"
ng-click="goBack()"
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -136,10 +136,10 @@
<h6 style="font-weight: bold">Password Protection</h6> <h6 style="font-weight: bold">Password Protection</h6>
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input <input
type="radio" data-toggle="modal" type="radio" data-toggle="modal"
data-target="#Passwordprotection" data-target="#Passwordprotection"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty" class="custom-control-input ng-pristine ng-untouched ng-valid ng-not-empty"
id="passwdprotection"> id="passwdprotection">
<label class="custom-control-label" <label class="custom-control-label"
for="passwdprotection"></label> for="passwdprotection"></label>
</div> </div>
@@ -163,18 +163,18 @@
</div> </div>
<div class="modal-body" style="height: 100px;"> <div class="modal-body" style="height: 100px;">
<div> <div>
<label class="col-sm-4">Username</label> <label class="col-sm-4">Username</label>
<input required class="col-lg-8" <input required class="col-lg-8"
type="text" placeholder="Username" > type="text" placeholder="Username">
</div> </div>
<div style="margin-top: 36px;"> <div style="margin-top: 36px;">
<label class="col-sm-4">Password</label> <label class="col-sm-4">Password</label>
<input required class="col-lg-8" <input required class="col-lg-8"
type="password" placeholder="*******************" > type="password" placeholder="*******************">
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -419,67 +419,81 @@
</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="col-sm-6"> <div class="example-box-wrapper">
<select id="backuptype" class="form-control">
<option value="1">Website and DataBase Both</option>
<option value="2">Only Website Data</option>
<option value="3">Only DataBase</option>
</select>
</div> <form name="websiteCreationForm" action="/" id="createPackages"
</div> class="form-horizontal bordered-row panel-body">
<div class="col-sm-12 center-div" style="margin-top: 4%"> <div ng-hide="installationDetailsForm" class="form-group">
<button id="createbackupbutton" type="button" <label class="col-sm-3 control-label">{% trans "Select Backup type" %}</label>
ng-click="CreateBackup()" <div class="col-sm-6">
class="btn btn-primary btn-lg center-div">{% trans "Create Backup" %}</button> <select id="backuptype" class="form-control">
</div> <option value="1">Website and Database Both</option>
<div style="margin-top: 1%" ng-hide="installationProgress" class="form-group"> <option value="2">Only Website Data</option>
<label class="col-sm-2 control-label"></label> <option value="3">Only Database</option>
<div class="col-sm-7"> </select>
</div>
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</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 class="progress"> </div>
<div id="installProgressbackup" class="progress-bar" </div>
role="progressbar" aria-valuenow="70" <div style="margin-top: 1%" ng-hide="installationProgress"
aria-valuemin="0" aria-valuemax="100" class="form-group">
style="width:0%"> <label class="col-sm-2 control-label"></label>
<span class="sr-only">70% Complete</span> <div class="col-sm-7">
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</div>
<div class="progress">
<div id="installProgressbackup" 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 "Backup 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 center-div">
<div class="col-sm-12">
<button type="button" ng-disabled="goBackDisable"
ng-click="goBack()"
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div> </div>
</div> </div>
<div ng-hide="errorMessageBox" class="alert alert-danger"> </form>
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="success" class="alert alert-success">
<p>{% trans "Backup 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 center-div">
<div class="col-sm-12">
<button type="button" ng-disabled="goBackDisable"
ng-click="goBack()"
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
</div>
</div> </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">

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)