mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
Merge branch 'v2.3.2-dev' of github.com:usmannasir/cyberpanel into v2.3.2-dev
This commit is contained in:
@@ -3345,62 +3345,10 @@ $parameters = array(
|
||||
except:
|
||||
####Website found --> WPsite Found --> Final URL Not Match
|
||||
####Create new obj and call wordpressnew
|
||||
DataToPass = {}
|
||||
|
||||
DataToPass['title'] = config['WPtitle']
|
||||
DataToPass['WPVersion'] = "6.0"
|
||||
DataToPass['adminUser'] = config['WebVHuser']
|
||||
DataToPass['Email'] = config['WebadminEmail']
|
||||
DataToPass['PasswordByPass'] = config['DatabaseUser']
|
||||
DataToPass['AutomaticUpdates'] = config['WPAutoUpdates']
|
||||
DataToPass['Plugins'] = config['WPPluginUpdates']
|
||||
DataToPass['Themes'] = config['WPThemeUpdates']
|
||||
DataToPass['websiteOwner'] = WebOwner
|
||||
DataToPass['package'] = packegs
|
||||
|
||||
# create path
|
||||
try:
|
||||
abc = config['WPsitepath'].split("/")
|
||||
wppamndath = abc[4]
|
||||
home = "0"
|
||||
except:
|
||||
abc = config['WPsitepath'].split("/")
|
||||
wppamndath = abc[3]
|
||||
home = "1"
|
||||
DataToPass['domain'] = webobj.domain
|
||||
DataToPass['path'] = wppamndath
|
||||
DataToPass['home'] = home
|
||||
Furlofnewp = "%s/%s" % (webobj.domain, wppamndath)
|
||||
|
||||
try:
|
||||
website = Websites.objects.get(domain=DomainName)
|
||||
logging.statusWriter(self.tempStatusPath, 'Web Site Already Exist.[404]')
|
||||
except:
|
||||
ab = WebsiteManager()
|
||||
coreResult = ab.submitWorpressCreation(userID, DataToPass)
|
||||
coreResult1 = json.loads((coreResult).content)
|
||||
logging.writeToFile("WP Creating website result....%s" % coreResult1)
|
||||
reutrntempath = coreResult1['tempStatusPath']
|
||||
while (1):
|
||||
lastLine = open(reutrntempath, 'r').read()
|
||||
logging.writeToFile("Error WP creating lastline ....... %s" % lastLine)
|
||||
if lastLine.find('[200]') > -1:
|
||||
break
|
||||
elif lastLine.find('[404]') > -1:
|
||||
logging.statusWriter(self.tempStatusPath,
|
||||
'Failed to WordPress: error: %s. [404]' % lastLine)
|
||||
return 0
|
||||
else:
|
||||
logging.statusWriter(self.tempStatusPath, 'Creating WordPress....,20')
|
||||
time.sleep(2)
|
||||
|
||||
##### Now resting start
|
||||
newWPobj = WPSites.objects.get(FinalURL=Furlofnewp)
|
||||
## get WPsite Database name and usr
|
||||
Newurl = newWPobj.FinalURL
|
||||
WPpath = newWPobj.path
|
||||
VHuser = newWPobj.owner.externalApp
|
||||
PhpVersion = newWPobj.owner.phpSelection
|
||||
Newurl = wpsite.FinalURL
|
||||
WPpath = wpsite.path
|
||||
VHuser = wpsite.owner.externalApp
|
||||
PhpVersion = wpsite.owner.phpSelection
|
||||
php = PHPManager.getPHPString(PhpVersion)
|
||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||
|
||||
@@ -3449,7 +3397,7 @@ $parameters = array(
|
||||
if result == 0:
|
||||
raise BaseException(stdout)
|
||||
|
||||
command = f'chown -R {newWPobj.owner.externalApp}:{newWPobj.owner.externalApp} {self.tempPath}'
|
||||
command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}'
|
||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||
|
||||
if result == 0:
|
||||
@@ -3544,12 +3492,16 @@ $parameters = array(
|
||||
if stdout.find('Error:') > -1:
|
||||
raise BaseException(stdout)
|
||||
|
||||
# ##Remove temppath
|
||||
command = f'rm -rf {self.tempPath}'
|
||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||
# # ##Remove temppath
|
||||
# command = f'rm -rf {self.tempPath}'
|
||||
# result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||
#
|
||||
# if result == 0:
|
||||
# raise BaseException(stdout)
|
||||
|
||||
if result == 0:
|
||||
raise BaseException(stdout)
|
||||
|
||||
|
||||
#################################################################
|
||||
|
||||
|
||||
|
||||
@@ -3822,6 +3774,7 @@ $parameters = array(
|
||||
elif(DomainName != "" and int(self.extraArgs['DesSiteID']) == -1):
|
||||
###############Create New WordPressSite First
|
||||
# logging.writeToFile("New Website Domain ....... %s" % str(DomainName))
|
||||
# logging.writeToFile("New Website Domain path....... %s" % str(self.extraArgs['path']))
|
||||
DataToPass = {}
|
||||
|
||||
DataToPass['title'] = config['WPtitle']
|
||||
@@ -3839,24 +3792,19 @@ $parameters = array(
|
||||
oldpath = config['WPsitepath']
|
||||
abc = oldpath.split("/")
|
||||
newpath = abc[4]
|
||||
if newpath != "":
|
||||
newurl = "%s/%s"%(DomainName,newpath)
|
||||
else:
|
||||
newurl = DomainName
|
||||
home = "0"
|
||||
oldhome = "0"
|
||||
except BaseException as msg:
|
||||
newpath = ""
|
||||
oldhome = "1"
|
||||
|
||||
if self.extraArgs['path'] == '':
|
||||
newurl = DomainName
|
||||
home = "1"
|
||||
else:
|
||||
newurl = "%s/%s"%(DomainName, self.extraArgs['path'])
|
||||
|
||||
DataToPass['path'] = newpath
|
||||
DataToPass['path'] = self.extraArgs['path']
|
||||
|
||||
DataToPass['home'] = home
|
||||
DataToPass['home'] = self.extraArgs['home']
|
||||
|
||||
try:
|
||||
website = Websites.objects.get(domain=DomainName)
|
||||
logging.statusWriter(self.tempStatusPath, 'Web Site Already Exist.[404]')
|
||||
except:
|
||||
ab = WebsiteManager()
|
||||
coreResult = ab.submitWorpressCreation(userID, DataToPass)
|
||||
coreResult1 = json.loads((coreResult).content)
|
||||
@@ -3868,7 +3816,8 @@ $parameters = array(
|
||||
if lastLine.find('[200]') > -1:
|
||||
break
|
||||
elif lastLine.find('[404]') > -1:
|
||||
logging.statusWriter(self.tempStatusPath, 'Failed to Create WordPress: error: %s. [404]'% lastLine)
|
||||
logging.statusWriter(self.tempStatusPath,
|
||||
'Failed to Create WordPress: error: %s. [404]' % lastLine)
|
||||
return 0
|
||||
else:
|
||||
logging.statusWriter(self.tempStatusPath, 'Creating WordPress....,20')
|
||||
@@ -3880,8 +3829,6 @@ $parameters = array(
|
||||
PhpVersion = NewWPsite.owner.phpSelection
|
||||
newWPpath = NewWPsite.path
|
||||
|
||||
|
||||
|
||||
###### Same code already used in Existing site
|
||||
|
||||
### get WPsite Database name and usr
|
||||
@@ -3962,10 +3909,9 @@ $parameters = array(
|
||||
if result == 0:
|
||||
raise BaseException(stdout)
|
||||
|
||||
|
||||
logging.statusWriter(self.tempStatusPath, 'Copying Data File...,60')
|
||||
###Copy backup content to newsite
|
||||
if home == "0":
|
||||
if oldhome == "0":
|
||||
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath)
|
||||
else:
|
||||
unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/public_html/" % (self.tempPath, oldtemppath)
|
||||
@@ -3976,7 +3922,6 @@ $parameters = array(
|
||||
if result == 0:
|
||||
raise BaseException(stdout)
|
||||
|
||||
|
||||
command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath)
|
||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||
|
||||
|
||||
@@ -1556,19 +1556,31 @@ app.controller('RestoreWPBackup', function ($scope, $http, $timeout, $window) {
|
||||
$scope.goBackDisable = true;
|
||||
$scope.currentStatus = "Start Restoring WordPress..";
|
||||
|
||||
var Domain = $scope.domainNameCreate;
|
||||
var path = $('#wprestoresubdirpath').val()
|
||||
var home = "1";
|
||||
|
||||
if (typeof path != 'undefined' || path != '') {
|
||||
home = "0";
|
||||
}
|
||||
|
||||
var backuptype = $('#backuptype').html();
|
||||
var data;
|
||||
if (backuptype == "DataBase Backup") {
|
||||
data = {
|
||||
backupid: $('#backupid').html(),
|
||||
DesSite: $('#DesSite').children("option:selected").val(),
|
||||
Domain: ''
|
||||
Domain: '',
|
||||
path: path,
|
||||
home: home,
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
backupid: $('#backupid').html(),
|
||||
DesSite: $('#DesSite').children("option:selected").val(),
|
||||
Domain: $("input[name=Newdomain]").val()
|
||||
Domain: Domain,
|
||||
path: path,
|
||||
home: home,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,17 +68,39 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="Newsitediv" ng-hide="installationDetailsForm" style="display: none"
|
||||
class="form-group">
|
||||
<label class="col-sm-2 control-label">{% trans "Website Domain" %}</label>
|
||||
<div id="Newsitediv" ng-hide="installationDetailsForm" style="display: none" class="form-group">
|
||||
<label class="col-sm-2 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="Newdomain" id="Newdomain" type="url"
|
||||
placeholder="Enter New Website Domain for Restoring Website "
|
||||
class="form-control" required>
|
||||
<div class="input-group bootstrap-touchspin">
|
||||
<span
|
||||
class="input-group-addon bootstrap-touchspin-prefix"
|
||||
style="display: none;"></span>
|
||||
<input ng-model="domainNameCreate" id="touchspin-demo-1" class="form-control"
|
||||
type="text" value="55"
|
||||
name="touchspin-demo-1"
|
||||
style="display: block;"
|
||||
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}">
|
||||
<span class="input-group-addon bootstrap-touchspin-postfix">/</span>
|
||||
<span style="width: 25%" class="input-group-btn">
|
||||
<input id="wprestoresubdirpath" class="form-control"
|
||||
placeholder="{% trans "Leave empty for default" %}"
|
||||
type="text" value="Leave empty for default"
|
||||
name="wprestoresubdirpath" ng-model="installPath"
|
||||
style="display: block;"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# <div id="Newsitediv" ng-hide="installationDetailsForm" style="display: none"#}
|
||||
{# class="form-group">#}
|
||||
{# <label class="col-sm-2 control-label">{% trans "Website Domain" %}</label>#}
|
||||
{# <div class="col-sm-10">#}
|
||||
{# <input name="Newdomain" id="Newdomain" type="url"#}
|
||||
{# placeholder="Enter New Website Domain for Restoring Website "#}
|
||||
{# class="form-control" required>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{% endif %}
|
||||
<div ng-model="installationDetailsForm" class="col-sm-12 center-div">
|
||||
<div ng-model="installationDetailsForm" class="col-sm-12 center-div" class="form-control">
|
||||
<button id="RestoreWPbackupNow" type="button"
|
||||
ng-click="RestoreWPbackupNow()"
|
||||
class="btn btn-primary btn-lg center-div">{% trans "Restore Backup Now" %}</button>
|
||||
|
||||
@@ -185,15 +185,17 @@ class WebsiteManager:
|
||||
try:
|
||||
wpsite = WPSites.objects.get(pk=sub.WPSiteID)
|
||||
web = wpsite.title
|
||||
except:
|
||||
web = "Website Not Found"
|
||||
|
||||
try:
|
||||
config = sub.config
|
||||
conf = json.loads(config)
|
||||
Backuptype = conf['Backuptype']
|
||||
except:
|
||||
web = "Website Not Found"
|
||||
Backuptype = "Backup type not exists"
|
||||
|
||||
|
||||
|
||||
Data['job'].append({
|
||||
'id': sub.id,
|
||||
'title': web,
|
||||
@@ -810,14 +812,16 @@ class WebsiteManager:
|
||||
backupid = data['backupid']
|
||||
DesSiteID = data['DesSite']
|
||||
|
||||
logging.CyberCPLogFileWriter.writeToFile("Error WP ChangeStatusThemes ....... %s"%data)
|
||||
Domain = data['Domain']
|
||||
|
||||
|
||||
extraArgs = {}
|
||||
extraArgs['adminID'] = admin.pk
|
||||
extraArgs['backupid'] = backupid
|
||||
extraArgs['DesSiteID'] = DesSiteID
|
||||
extraArgs['Domain'] = Domain
|
||||
extraArgs['path'] = data['path']
|
||||
extraArgs['home'] = data['home']
|
||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user