From 4b36b2971a40accff763d2936f18d99893063960 Mon Sep 17 00:00:00 2001 From: Hassan Hashmi <75794688+habbi-hb@users.noreply.github.com> Date: Sat, 18 Jun 2022 16:38:00 +0500 Subject: [PATCH] backuptestDataBaseandwebonly --- plogical/applicationInstaller.py | 504 ++++++++++-------- .../websiteFunctions/websiteFunctions.js | 6 +- 2 files changed, 284 insertions(+), 226 deletions(-) diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 2a25d07e0..68f3ad321 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -2887,147 +2887,197 @@ $parameters = array( installUtilities.reStartLiteSpeed() ####Check if BAckup type is Only Webdata elif BackupType == 'Website Backup': - ############## Existing site if (DomainName == "" and int(self.extraArgs['DesSiteID']) != -1): wpsite = WPSites.objects.get(pk=DesSiteID) - VHuser = wpsite.owner.externalApp - 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" - - ### Create secure folder - - ACLManager.CreateSecureDir() - RandomPath = str(randint(1000, 9999)) - self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath) - - command = f'mkdir -p {self.tempPath}' - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}' - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30') - - ###First copy backup file to temp and then Unzip - command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - #### Make temp dir ab for unzip - command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % ( - VHuser, self.tempPath, BackUpFileName, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - logging.statusWriter(self.tempStatusPath, 'Copying Data File...,50') - ###Copy backup content to newsite - if home == "0": - #### Check If sub dir in New web site + webobj = Websites.objects.get(pk=wpsite.owner_id) + ag = WPSites.objects.filter(owner=webobj).count() + if ag > 0: + ###Website found --> Wpsite Found + finalurl = "%s%s" % (webobj.domain, oldurl[oldurl.find('/'):]) try: - kl = newWPpath.split("/") - newpathexta = kl[4] - if newpathexta != "": - newsubdir = "0" - else: - newsubdir = "1" - except BaseException as msg: - newsubdir = "1" + WPobj = WPSites.objects.get(FinalURL=finalurl, owner=webobj) + ###Website found --> WPsite Found --> Final URL Match + #### Do not create Ne site + ### get WPsite Database name and usr + VHuser = wpsite.owner.externalApp + PhpVersion = WPobj.owner.phpSelection + newWPpath = WPobj.path + php = PHPManager.getPHPString(PhpVersion) + FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) - 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) + ### Create secure folder + + ACLManager.CreateSecureDir() + RandomPath = str(randint(1000, 9999)) + self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath) + + command = f'mkdir -p {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) if result == 0: raise BaseException(stdout) - 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) + command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}' result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) if result == 0: raise BaseException(stdout) - Webnewpath = str(newWPpath) + str(pathexta) - else: + logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30') - unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath) - Webnewpath = newWPpath + ###First copy backup file to temp and then Unzip + command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, Webnewpath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + if result == 0: + raise BaseException(stdout) - if result == 0: - raise BaseException(stdout) + #### Make temp dir ab for unzip + command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, Webnewpath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + if result == 0: + raise BaseException(stdout) - if result == 0: - raise BaseException(stdout) + command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % ( + VHuser, self.tempPath, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90') - ########Now Replace URL's - command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % ( - VHuser, newWPpath, oldurl, newurl) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + if result == 0: + raise BaseException(stdout) - if stdout.find('Error:') > -1: - raise BaseException(stdout) + unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath) - command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % ( - VHuser, newWPpath, newurl, newurl) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, newWPpath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - if stdout.find('Error:') > -1: - raise BaseException(stdout) + if result == 0: + raise BaseException(stdout) - # ##Remove temppath - command = f'rm -rf {self.tempPath}' - ProcessUtilities.executioner(command) + command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - ###Restart Server + if result == 0: + raise BaseException(stdout) - from plogical.installUtilities import installUtilities - installUtilities.reStartLiteSpeed() - ############## New Site + + + logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90') + ########Now Replace URL's + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % ( + VHuser, newWPpath, oldurl, finalurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if stdout.find('Error:') > -1: + raise BaseException(stdout) + + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % ( + VHuser, newWPpath, finalurl, finalurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + 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) + + if result == 0: + raise BaseException(stdout) + + except: + ####Website found --> WPsite Found --> Final URL Not Match + ####Create new obj and call wordpressnew + 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) + + + + ### Create secure folder + + ACLManager.CreateSecureDir() + RandomPath = str(randint(1000, 9999)) + self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath) + + command = f'mkdir -p {self.tempPath}' + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + command = f'chown -R {wpsite.owner.externalApp}:{wpsite.owner.externalApp} {self.tempPath}' + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,30') + + ###First copy backup file to temp and then Unzip + command = "sudo -u %s cp -R /home/backup/%s* %s" % ( + VHuser, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + #### Make temp dir ab for unzip + command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % ( + VHuser, self.tempPath, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath) + + command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, WPpath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, WPpath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + + + logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90') + ########Now Replace URL's + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % ( + VHuser, WPpath, oldurl, Newurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if stdout.find('Error:') > -1: + raise BaseException(stdout) + + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % ( + VHuser, WPpath, Newurl, Newurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + 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) + + if result == 0: + raise BaseException(stdout) elif (DomainName != "" and int(self.extraArgs['DesSiteID']) == -1): - ###############Create New WordPressSite First - # logging.writeToFile("New Website Domain ....... %s" % str(DomainName)) DataToPass = {} DataToPass['title'] = config['WPtitle'] @@ -3045,137 +3095,141 @@ $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) - 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) - - logging.statusWriter(self.tempStatusPath, 'Restoring site ....,30') - NewWPsite = WPSites.objects.get(FinalURL=newurl) - VHuser = NewWPsite.owner.externalApp - newWPpath = NewWPsite.path - - ### Create secure folder - - ACLManager.CreateSecureDir() - RandomPath = str(randint(1000, 9999)) - self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath) - - command = f'mkdir -p {self.tempPath}' - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - command = f'chown -R {NewWPsite.owner.externalApp}:{NewWPsite.owner.externalApp} {self.tempPath}' - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,40') - - ###First copy backup file to temp and then Unzip - command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - #### Make temp dir ab for unzip - command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % ( - VHuser, self.tempPath, BackUpFileName, self.tempPath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - - if result == 0: - raise BaseException(stdout) - - logging.statusWriter(self.tempStatusPath, 'Copying Data File...,60') - ###Copy backup content to newsite - if home == "0": - unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/" % (self.tempPath, oldtemppath) + 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 Create WordPress: error: %s. [404]' % lastLine) + return 0 else: - unzippath = "%s/ab/usr/local/CyberCP/tmp/%s/public_html/public_html/" % ( - self.tempPath, oldtemppath) + logging.statusWriter(self.tempStatusPath, 'Creating WordPress....,20') + time.sleep(2) - command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, newWPpath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + logging.statusWriter(self.tempStatusPath, 'Restoring site ....,30') + NewWPsite = WPSites.objects.get(FinalURL=newurl) + VHuser = NewWPsite.owner.externalApp + PhpVersion = NewWPsite.owner.phpSelection + newWPpath = NewWPsite.path - if result == 0: - raise BaseException(stdout) + ###### Same code already used in Existing site - command = "sudo -u %s cp -R %s.[^.]* %s" % (VHuser, unzippath, newWPpath) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + ### get WPsite Database name and usr + php = PHPManager.getPHPString(PhpVersion) + FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php) - if result == 0: - raise BaseException(stdout) + + ### Create secure folder + + ACLManager.CreateSecureDir() + RandomPath = str(randint(1000, 9999)) + self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', RandomPath) + + command = f'mkdir -p {self.tempPath}' + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + command = f'chown -R {NewWPsite.owner.externalApp}:{NewWPsite.owner.externalApp} {self.tempPath}' + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + logging.statusWriter(self.tempStatusPath, 'Extracting Backup File...,40') + + ###First copy backup file to temp and then Unzip + command = "sudo -u %s cp -R /home/backup/%s* %s" % (VHuser, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + #### Make temp dir ab for unzip + command = "sudo -u %s mkdir %s/ab" % (VHuser, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + command = "sudo -u %s tar -xvf %s/%s.tar.gz -C %s/ab" % ( + VHuser, self.tempPath, BackUpFileName, self.tempPath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + if result == 0: + raise BaseException(stdout) + + logging.statusWriter(self.tempStatusPath, 'Copying Data File...,60') + ###Copy backup content to newsite + 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) + + command = "sudo -u %s cp -R %s* %s" % (VHuser, unzippath, newWPpath) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + + 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) + + if result == 0: + raise BaseException(stdout) - logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90') - ########Now Replace URL's - command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % ( - VHuser, newWPpath, oldurl, newurl) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + logging.statusWriter(self.tempStatusPath, 'Replacing URLs...,90') + ########Now Replace URL's + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path=%s "%s" "%s"' % ( + VHuser, newWPpath, oldurl, newurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - if stdout.find('Error:') > -1: - raise BaseException(stdout) + if stdout.find('Error:') > -1: + raise BaseException(stdout) - command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % ( - VHuser, newWPpath, newurl, newurl) - result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + command = 'sudo -u %s /usr/local/lsws/lsphp74/bin/php -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --allow-root --path=%s "https://www.%s" "http://%s"' % ( + VHuser, newWPpath, newurl, newurl) + result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1) - if stdout.find('Error:') > -1: - raise BaseException(stdout) + 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 stdout.find('Error:') > -1: + raise BaseException(stdout) - ###Restart Server + ###Restart Server + + from plogical.installUtilities import installUtilities + installUtilities.reStartLiteSpeed() - from plogical.installUtilities import installUtilities - installUtilities.reStartLiteSpeed() ####Check if backup type is Both web and DB else: ############## Existing site diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 7dad26448..72a73ac40 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -1557,12 +1557,16 @@ app.controller('RestoreWPBackup', function ($scope, $http, $timeout, $window) { $scope.currentStatus = "Start Restoring WordPress.."; var Domain = $('#wprestoresubdirdomain').val() - var path = $('#wprestoresubdirpath').val() + var path = $('#wprestoresubdirpath').val(); var home = "1"; if (typeof path != 'undefined' || path != '') { home = "0"; } + if (typeof path == 'undefined' ) { + path = ""; + } + var backuptype = $('#backuptype').html(); var data;