mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
Merge branch 'v2.3.2-dev' of https://github.com/usmannasir/cyberpanel into v2.3.2-dev
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/local/CyberCP/bin/python
|
#!/usr/local/CyberCP/bin/python
|
||||||
import argparse
|
import argparse
|
||||||
import os, sys
|
import os, sys
|
||||||
|
import shutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from loginSystem.models import Administrator
|
from loginSystem.models import Administrator
|
||||||
@@ -75,6 +76,8 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
self.ChangeStatusThemes()
|
self.ChangeStatusThemes()
|
||||||
elif self.installApp == 'CreateStagingNow':
|
elif self.installApp == 'CreateStagingNow':
|
||||||
self.CreateStagingNow()
|
self.CreateStagingNow()
|
||||||
|
elif self.installApp == 'DeploytoProduction':
|
||||||
|
self.DeploytoProduction()
|
||||||
elif self.installApp == 'WPCreateBackup':
|
elif self.installApp == 'WPCreateBackup':
|
||||||
self.WPCreateBackup()
|
self.WPCreateBackup()
|
||||||
|
|
||||||
@@ -1985,8 +1988,10 @@ $parameters = array(
|
|||||||
ab = WebsiteManager()
|
ab = WebsiteManager()
|
||||||
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
|
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
|
||||||
coreResult1 = json.loads((coreResult).content)
|
coreResult1 = json.loads((coreResult).content)
|
||||||
|
|
||||||
if os.path.exists('/usr/local/CyberCP/debug'):
|
if os.path.exists('/usr/local/CyberCP/debug'):
|
||||||
logging.writeToFile("Creating website result....%s" % coreResult1)
|
logging.writeToFile("Creating website result....%s" % coreResult1)
|
||||||
|
|
||||||
reutrntempath = coreResult1['tempStatusPath']
|
reutrntempath = coreResult1['tempStatusPath']
|
||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
@@ -2006,7 +2011,7 @@ $parameters = array(
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines('Installing WordPress....')
|
statusFile.writelines('Installing WordPress....,30')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
####No crreating DataBAse.............
|
####No crreating DataBAse.............
|
||||||
@@ -2033,20 +2038,18 @@ $parameters = array(
|
|||||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
## Staging site
|
## Staging site
|
||||||
|
|
||||||
StagingPath = f'/home/{website.domain}/public_html'
|
StagingPath = f'/home/{website.domain}/public_html'
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp core download --path={StagingPath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp core download --path={StagingPath}'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
|
||||||
|
if ProcessUtilities.executioner(command, website.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to download wp core. [404]')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp core config --dbname={dbNameRestore} --dbuser={dbUser} --dbpass={dbPassword} --dbhost={ApplicationInstaller.LOCALHOST}:{ApplicationInstaller.PORT} --path={StagingPath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp core config --dbname={dbNameRestore} --dbuser={dbUser} --dbpass={dbPassword} --dbhost={ApplicationInstaller.LOCALHOST}:{ApplicationInstaller.PORT} --path={StagingPath}'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
if ProcessUtilities.executioner(command, website.externalApp) == 0:
|
||||||
|
raise BaseException('WP Core congiruations failed. [404]')
|
||||||
|
|
||||||
try:
|
|
||||||
masterPath = '/home/%s/public_html/%s' % (masterDomain, path)
|
|
||||||
replaceDomain = '%s/%s' % (masterDomain, path)
|
|
||||||
except:
|
|
||||||
masterPath = '/home/%s/public_html' % (masterDomain)
|
|
||||||
replaceDomain = masterDomain
|
|
||||||
|
|
||||||
### Get table prefix of master site
|
### Get table prefix of master site
|
||||||
|
|
||||||
@@ -2056,7 +2059,8 @@ $parameters = array(
|
|||||||
## Export database from master site
|
## Export database from master site
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={path} db export {tempPath}/dbexport-stage.sql'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={path} db export {tempPath}/dbexport-stage.sql'
|
||||||
ProcessUtilities.executioner(command, wpobj.owner.externalApp)
|
if ProcessUtilities.executioner(command, wpobj.owner.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to export database from master site. [404]')
|
||||||
|
|
||||||
## Copy wp content folder to securey path
|
## Copy wp content folder to securey path
|
||||||
|
|
||||||
@@ -2064,15 +2068,19 @@ $parameters = array(
|
|||||||
WpContentPath = ProcessUtilities.outputExecutioner(command, wpobj.owner.externalApp).splitlines()[-1].replace('themes', '')
|
WpContentPath = ProcessUtilities.outputExecutioner(command, wpobj.owner.externalApp).splitlines()[-1].replace('themes', '')
|
||||||
|
|
||||||
command = f'cp -R {WpContentPath} {tempPath}/'
|
command = f'cp -R {WpContentPath} {tempPath}/'
|
||||||
ProcessUtilities.executioner(command, wpobj.owner.externalApp)
|
if ProcessUtilities.executioner(command, wpobj.owner.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to copy wp-content from master to temp folder. [404]')
|
||||||
|
|
||||||
command = f'cp -f {path}/.htaccess {tempPath}/'
|
command = f'cp -f {path}/.htaccess {tempPath}/'
|
||||||
ProcessUtilities.executioner(command, wpobj.owner.externalApp)
|
|
||||||
|
if ProcessUtilities.executioner(command, wpobj.owner.externalApp) == 0:
|
||||||
|
logging.writeToFile('While staging creation .htaccess file did not copy')
|
||||||
|
|
||||||
### Set table prefix
|
### Set table prefix
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set table_prefix {TablePrefix} --path={StagingPath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config set table_prefix {TablePrefix} --path={StagingPath}'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
if ProcessUtilities.executioner(command, website.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to set table prefix on staging site. [404]')
|
||||||
|
|
||||||
### Change permissions of temp folder to staging site
|
### Change permissions of temp folder to staging site
|
||||||
|
|
||||||
@@ -2083,7 +2091,8 @@ $parameters = array(
|
|||||||
## Import Database
|
## Import Database
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={StagingPath} --quiet db import {tempPath}/dbexport-stage.sql'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={StagingPath} --quiet db import {tempPath}/dbexport-stage.sql'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
if ProcessUtilities.executioner(command, website.externalApp) ==0:
|
||||||
|
raise BaseException('Failed to import database on staging site. [404]')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'rm -f %s/dbexport-stage.sql' % (tempPath)
|
command = 'rm -f %s/dbexport-stage.sql' % (tempPath)
|
||||||
@@ -2097,28 +2106,32 @@ $parameters = array(
|
|||||||
ProcessUtilities.executioner(command, website.externalApp)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
command = f'mv {tempPath}/wp-content {StagingPath}/'
|
command = f'mv {tempPath}/wp-content {StagingPath}/'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
if ProcessUtilities.executioner(command, website.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to copy wp-content from temp to staging site. [404]')
|
||||||
|
|
||||||
## Copy htaccess
|
## Copy htaccess
|
||||||
|
|
||||||
command = f'cp -f {tempPath}/.htaccess {StagingPath}/'
|
command = f'cp -f {tempPath}/.htaccess {StagingPath}/'
|
||||||
ProcessUtilities.executioner(command, wpobj.owner.externalApp)
|
if ProcessUtilities.executioner(command, wpobj.owner.externalApp) == 0:
|
||||||
|
logging.writeToFile('While staging creation .htaccess file did not copy')
|
||||||
|
|
||||||
## Search and replace url
|
## Search and replace url
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "{replaceDomain}" "{domain}"'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "{masterDomain}" "{domain}"'
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
if ProcessUtilities.executioner(command, website.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 1. [404]')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "www.{replaceDomain}" "{domain}"'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "www.{masterDomain}" "{domain}"'
|
||||||
ProcessUtilities.executioner(command,website.externalApp)
|
if ProcessUtilities.executioner(command,website.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 2. [404]')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "https://{domain}" "http://{domain}"'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={StagingPath} "https://{domain}" "http://{domain}"'
|
||||||
ProcessUtilities.executioner(command,website.externalApp)
|
if ProcessUtilities.executioner(command,website.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 3. [404]')
|
||||||
|
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
|
|
||||||
wpsite = WPSites(owner=website, title=self.data['StagingName'],
|
wpsite = WPSites(owner=website, title=self.data['StagingName'],
|
||||||
path ="/home/%s/public_html"%(self.extraArgs['StagingDomain']),
|
path ="/home/%s/public_html"%(self.extraArgs['StagingDomain']),
|
||||||
FinalURL='%s' % (self.data['StagingDomain']))
|
FinalURL='%s' % (self.data['StagingDomain']))
|
||||||
@@ -2128,20 +2141,123 @@ $parameters = array(
|
|||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
WPStaging(wpsite=wpsite, owner=wpobj).save()
|
WPStaging(wpsite=wpsite, owner=wpobj).save()
|
||||||
|
|
||||||
|
|
||||||
statusFile = open(currentTemp, 'w')
|
statusFile = open(currentTemp, 'w')
|
||||||
statusFile.writelines('Staging site created,[200]')
|
statusFile.writelines('Staging site created,[200]')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
command = f'rm -rf {self.tempPath}'
|
command = f'rm -rf {self.tempPath}'
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
statusFile = open(self.tempStatusPath, 'w')
|
statusFile = open(self.tempStatusPath, 'w')
|
||||||
statusFile.writelines(f'{str(msg)}[404]')
|
statusFile.writelines(f'{str(msg)}[404]')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
logging.writeToFile("Error WP ChangeStatusThemes ....... %s" % str(msg))
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def DeploytoProduction(self):
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.tempStatusPath = self.extraArgs['tempStatusPath']
|
||||||
|
self.statgingID = self.extraArgs['statgingID']
|
||||||
|
self.WPid = self.extraArgs['WPid']
|
||||||
|
|
||||||
|
StagingSite = WPSites.objects.get(pk=self.statgingID)
|
||||||
|
WPSite = WPSites.objects.get(pk=self.WPid)
|
||||||
|
|
||||||
|
### Create secure folder
|
||||||
|
ACLManager.CreateSecureDir()
|
||||||
|
self.tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', str(randint(1000, 9999)))
|
||||||
|
|
||||||
|
command = f'mkdir -p {self.tempPath}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
command = f'chown -R {StagingSite.owner.externalApp}:{StagingSite.owner.externalApp} {self.tempPath}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
|
||||||
|
from managePHP.phpManager import PHPManager
|
||||||
|
php = PHPManager.getPHPString(StagingSite.owner.phpSelection)
|
||||||
|
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
|
## Restore db
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Creating database backup..,10')
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={StagingSite.path} db export {self.tempPath}/dbexport-stage.sql'
|
||||||
|
if ProcessUtilities.executioner(command) == 0:
|
||||||
|
raise BaseException('Failed to create database backup of staging site. [404]')
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp theme path --skip-plugins --skip-themes --allow-root --path={WPSite.path}'
|
||||||
|
WpContentPath = ProcessUtilities.outputExecutioner(command, StagingSite.owner.externalApp).splitlines()[-1].replace('themes', '')
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Moving staging site content..,20')
|
||||||
|
|
||||||
|
command = f'cp -R {StagingSite.path}/wp-content/ {self.tempPath}/'
|
||||||
|
if ProcessUtilities.executioner(command, StagingSite.owner.externalApp) ==0:
|
||||||
|
raise BaseException('Failed copy wp-content from staging to temp folder. [404]')
|
||||||
|
|
||||||
|
command = f'cp -f {StagingSite.path}/.htaccess {self.tempPath}/'
|
||||||
|
ProcessUtilities.executioner(command, StagingSite.owner.externalApp)
|
||||||
|
|
||||||
|
### First import db backup to main site
|
||||||
|
|
||||||
|
command = f'chown -R {WPSite.owner.externalApp}:{WPSite.owner.externalApp} {self.tempPath}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
## Import Database
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Importing database..,60')
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp --allow-root --skip-plugins --skip-themes --path={WPSite.path} --quiet db import {self.tempPath}/dbexport-stage.sql'
|
||||||
|
if ProcessUtilities.executioner(command, WPSite.owner.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to import database backup into master site. [404]')
|
||||||
|
|
||||||
|
try:
|
||||||
|
command = 'rm -f %s/dbexport-stage.sql' % (self.tempPath)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Moving content..,80')
|
||||||
|
|
||||||
|
|
||||||
|
command = f'cp -R {self.tempPath}/wp-content/* {WpContentPath}'
|
||||||
|
if ProcessUtilities.executioner(command, WPSite.owner.externalApp) == 0:
|
||||||
|
raise BaseException('Failed to copy wp-content to master site. [404]')
|
||||||
|
|
||||||
|
## Search and replace url
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={WPSite.path} "{StagingSite.FinalURL}" "{WPSite.FinalURL}"'
|
||||||
|
if ProcessUtilities.executioner(command, WPSite.owner.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 1. [404]')
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={WPSite.path} "www.{StagingSite.FinalURL}" "{WPSite.FinalURL}"'
|
||||||
|
if ProcessUtilities.executioner(command, WPSite.owner.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 2. [404]')
|
||||||
|
|
||||||
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp search-replace --skip-plugins --skip-themes --path={WPSite.path} "https://{WPSite.FinalURL}" "http://{WPSite.FinalURL}"'
|
||||||
|
if ProcessUtilities.executioner(command, WPSite.owner.externalApp) == 0:
|
||||||
|
raise BaseException('search-replace failed 3. [404]')
|
||||||
|
|
||||||
|
from plogical.installUtilities import installUtilities
|
||||||
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
|
|
||||||
|
command = f'rm -rf {self.tempPath}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
|
||||||
|
logging.statusWriter(self.tempStatusPath, 'Completed.[200]')
|
||||||
|
|
||||||
|
return 0
|
||||||
|
except BaseException as msg:
|
||||||
|
command = f'rm -rf {self.tempPath}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
mesg = '%s. [404]' % (str(msg))
|
||||||
|
logging.statusWriter(self.tempStatusPath, mesg)
|
||||||
|
|
||||||
def WPCreateBackup(self):
|
def WPCreateBackup(self):
|
||||||
try:
|
try:
|
||||||
from managePHP.phpManager import PHPManager
|
from managePHP.phpManager import PHPManager
|
||||||
@@ -2303,6 +2419,7 @@ $parameters = array(
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Application Installer')
|
||||||
parser.add_argument('function', help='Specify a function to call!')
|
parser.add_argument('function', help='Specify a function to call!')
|
||||||
|
|||||||
@@ -905,6 +905,16 @@ autocreate_system_folders = On
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("CREATE TABLE `websiteFunctions_wpsitesbackup` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `WPSiteID` integer NOT NULL, `WebsiteID` integer NOT NULL, `config` longtext NOT NULL, `owner_id` integer NOT NULL); ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("ALTER TABLE `websiteFunctions_wpsitesbackup` ADD CONSTRAINT `websiteFunctions_wps_owner_id_8a8dd0c5_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`); ")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.close()
|
connection.close()
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -122,3 +122,9 @@ class WPSites(models.Model):
|
|||||||
class WPStaging(models.Model):
|
class WPStaging(models.Model):
|
||||||
owner = models.ForeignKey(WPSites, on_delete=models.CASCADE)
|
owner = models.ForeignKey(WPSites, on_delete=models.CASCADE)
|
||||||
wpsite = models.ForeignKey(WPSites, on_delete=models.CASCADE, related_name='actual_wpsite')
|
wpsite = models.ForeignKey(WPSites, on_delete=models.CASCADE, related_name='actual_wpsite')
|
||||||
|
|
||||||
|
class WPSitesBackup(models.Model):
|
||||||
|
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
|
||||||
|
WPSiteID = models.IntegerField(default=-1)
|
||||||
|
WebsiteID = models.IntegerField(default=-1)
|
||||||
|
config = models.TextField()
|
||||||
|
|||||||
@@ -444,6 +444,12 @@ function FinalDeleteWPNow() {
|
|||||||
window.location.href = FurlDeleteWP;
|
window.location.href = FurlDeleteWP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DeploytoProductionID;
|
||||||
|
|
||||||
|
function DeployToProductionInitial(vall) {
|
||||||
|
DeploytoProductionID = vall;
|
||||||
|
}
|
||||||
|
|
||||||
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
|
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
|
||||||
|
|
||||||
$scope.wordpresshomeloading = true;
|
$scope.wordpresshomeloading = true;
|
||||||
@@ -1322,19 +1328,33 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var DeploytoProductionID;
|
function AddStagings(value, index, array) {
|
||||||
|
var FinalMarkup = '<tr>'
|
||||||
function DeployToProductionInitial(vall) {
|
for (let x in value) {
|
||||||
DeploytoProductionID = vall;
|
if (x === 'name') {
|
||||||
|
FinalMarkup = FinalMarkup + '<td><a href=/websites/WPHome?ID=' + value.id + '>' + value[x] + '</a></td>';
|
||||||
|
} else if (x !== 'url' && x !== 'deleteURL' && x !== 'id') {
|
||||||
|
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FinalMarkup = FinalMarkup + '<td><button onclick="DeployToProductionInitial(' + value.id + ')" data-toggle="modal" data-target="#DeployToProduction" style="margin-bottom: 2%; display: block" aria-label="" type="button" class="btn btn-outline-primary">Deploy to Production</button>' +
|
||||||
|
'<a href="' + value.deleteURL + '"> <button aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></a></td>'
|
||||||
|
FinalMarkup = FinalMarkup + '</tr>'
|
||||||
|
AppendToTable('#StagingBody', FinalMarkup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function FinalDeployToProduction() {
|
$scope.FinalDeployToProduction = function () {
|
||||||
alert($('#WPid').html());
|
|
||||||
alert(DeploytoProductionID);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
$('#wordpresshomeloading').show();
|
$('#wordpresshomeloading').show();
|
||||||
$('#DeployToProduction').modal('hide');
|
|
||||||
|
$scope.wordpresshomeloading = false;
|
||||||
|
$scope.stagingDetailsForm = true;
|
||||||
|
$scope.installationProgress = false;
|
||||||
|
$scope.errorMessageBox = true;
|
||||||
|
$scope.success = true;
|
||||||
|
$scope.couldNotConnect = true;
|
||||||
|
$scope.goBackDisable = true;
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
WPid: $('#WPid').html(),
|
WPid: $('#WPid').html(),
|
||||||
StagingID: DeploytoProductionID
|
StagingID: DeploytoProductionID
|
||||||
@@ -1384,7 +1404,7 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.CreateBackup = function () {
|
$scope.CreateBackup = function () {
|
||||||
@@ -1445,21 +1465,6 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function AddStagings(value, index, array) {
|
|
||||||
var FinalMarkup = '<tr>'
|
|
||||||
for (let x in value) {
|
|
||||||
if (x === 'name') {
|
|
||||||
FinalMarkup = FinalMarkup + '<td><a href=/websites/WPHome?ID=' + value.id + '>' + value[x] + '</a></td>';
|
|
||||||
} else if (x !== 'url' && x !== 'deleteURL' && x !== 'id') {
|
|
||||||
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FinalMarkup = FinalMarkup + '<td><button onclick="DeployToProductionInitial(' + value.id + ')" data-toggle="modal" data-target="#DeployToProduction" style="margin-bottom: 2%; display: block" aria-label="" type="button" class="btn btn-outline-primary">Deploy to Production</button>' +
|
|
||||||
'<a href="' + value.deleteURL + '"> <button aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></a></td>'
|
|
||||||
FinalMarkup = FinalMarkup + '</tr>'
|
|
||||||
AppendToTable('#StagingBody', FinalMarkup);
|
|
||||||
}
|
|
||||||
|
|
||||||
var PluginsList = [];
|
var PluginsList = [];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -526,9 +526,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="DeployToProduction" class="modal fade" role="dialog">
|
<div id="DeployToProduction" class="modal fade" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<!-- Modal content-->
|
<!-- Modal content-->
|
||||||
@@ -552,7 +549,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary"
|
<button type="button" class="btn btn-primary"
|
||||||
onclick="FinalDeployToProduction()">Yes
|
ng-click="FinalDeployToProduction()" data-dismiss="modal">Yes
|
||||||
</button>
|
</button>
|
||||||
<button type="button" ng-disabled="savingSettings"
|
<button type="button" ng-disabled="savingSettings"
|
||||||
class="btn btn-default" data-dismiss="modal">
|
class="btn btn-default" data-dismiss="modal">
|
||||||
@@ -562,5 +559,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ def WPHome(request):
|
|||||||
return wm.WPHome(request, userID, WPid, DeleteID)
|
return wm.WPHome(request, userID, WPid, DeleteID)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def AutoLogin(request):
|
def AutoLogin(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -305,19 +306,19 @@ def DeploytoProduction(request):
|
|||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
|
|
||||||
result = pluginManager.preWebsiteCreation(request)
|
#result = pluginManager.preWebsiteCreation(request)
|
||||||
|
|
||||||
if result != 200:
|
#if result != 200:
|
||||||
return result
|
# return result
|
||||||
|
|
||||||
wm = WebsiteManager()
|
wm = WebsiteManager()
|
||||||
coreResult = wm.DeploytoProduction(userID, json.loads(request.body))
|
return wm.DeploytoProduction(userID, json.loads(request.body))
|
||||||
|
|
||||||
result = pluginManager.postWebsiteCreation(request, coreResult)
|
#result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||||
if result != 200:
|
#if result != 200:
|
||||||
return result
|
# return result
|
||||||
|
|
||||||
return coreResult
|
#return coreResult
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|||||||
@@ -659,20 +659,27 @@ class WebsiteManager:
|
|||||||
wpsite = WPSites.objects.get(pk=WPManagerID)
|
wpsite = WPSites.objects.get(pk=WPManagerID)
|
||||||
StagingObj = WPSites.objects.get(pk=statgingID)
|
StagingObj = WPSites.objects.get(pk=statgingID)
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(StagingObj.owner.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
extraArgs = {}
|
extraArgs = {}
|
||||||
extraArgs['adminID'] = admin.pk
|
extraArgs['adminID'] = admin.pk
|
||||||
extraArgs['StagingDomain'] = StagingObj.FinalURL
|
extraArgs['statgingID'] = statgingID
|
||||||
extraArgs['StagingName'] = StagingObj.title
|
|
||||||
extraArgs['WPid'] = WPManagerID
|
extraArgs['WPid'] = WPManagerID
|
||||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
|
|
||||||
|
background = ApplicationInstaller('DeploytoProduction', extraArgs)
|
||||||
background = ApplicationInstaller('CreateStagingNow', extraArgs)
|
|
||||||
background.start()
|
background.start()
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user