mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
wp manager cmplt
This commit is contained in:
@@ -1943,12 +1943,12 @@ class CloudManager:
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/applicationInstaller.py"
|
||||
execPath = execPath + " DeployWordPress --tempStatusPath %s --appsSet '%s' --domain '%s' --email '%s' --password '%s' " \
|
||||
"--pluginUpdates '%s' --themeUpdates '%s' --title '%s' --updates '%s' --userName '%s' " \
|
||||
"--version '%s'" % (
|
||||
"--version '%s' --createSite %s" % (
|
||||
tempStatusPath, self.data['appsSet'], self.data['domain'], self.data['email'],
|
||||
self.data['password'],
|
||||
self.data['pluginUpdates'], self.data['themeUpdates'], self.data['title'],
|
||||
self.data['updates'],
|
||||
self.data['userName'], self.data['version'])
|
||||
self.data['userName'], self.data['version'], str(self.data['createSite']))
|
||||
|
||||
try:
|
||||
execPath = '%s --path %s' % (execPath, self.data['path'])
|
||||
@@ -2489,3 +2489,24 @@ class CloudManager:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def WPScan(self):
|
||||
try:
|
||||
|
||||
path = '/home/%s/public_html' % (self.data['domainName'])
|
||||
|
||||
command = 'wp core version --allow-root --path=%s' % (path)
|
||||
result = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if result.find('Error:') > -1:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': 'This does not seem to be a WordPress installation'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_json = json.dumps({'status': 1})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -97,6 +97,8 @@ def router(request):
|
||||
return cm.ChangeState()
|
||||
elif controller == 'saveWPSettings':
|
||||
return cm.saveWPSettings()
|
||||
elif controller == 'WPScan':
|
||||
return cm.WPScan()
|
||||
elif controller == 'getCurrentS3Backups':
|
||||
return cm.getCurrentS3Backups()
|
||||
elif controller == 'deleteS3Backup':
|
||||
|
||||
@@ -683,6 +683,10 @@ Automatic backup failed for %s on %s.
|
||||
extraArgs['data'] = int(PlanConfig['data'])
|
||||
extraArgs['emails'] = int(PlanConfig['emails'])
|
||||
extraArgs['databases'] = int(PlanConfig['databases'])
|
||||
extraArgs['port'] = '0'
|
||||
extraArgs['ip'] = '0'
|
||||
extraArgs['destinationDomain'] = 'None'
|
||||
extraArgs['path'] = '/home/cyberpanel/backups/%s/backup-' % (items.domain) + items.domain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||
|
||||
bu = backupUtilities(extraArgs)
|
||||
result, fileName = bu.CloudBackups()
|
||||
|
||||
@@ -574,7 +574,10 @@ $parameters = array(
|
||||
except:
|
||||
command = "wp core download --allow-root --path=" + finalPath
|
||||
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
##
|
||||
|
||||
@@ -583,7 +586,10 @@ $parameters = array(
|
||||
statusFile.close()
|
||||
|
||||
command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=%s --dbprefix=wp_ --allow-root --path=" % (ApplicationInstaller.LOCALHOST) + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
if home == '0':
|
||||
path = self.extraArgs['path']
|
||||
@@ -592,7 +598,10 @@ $parameters = array(
|
||||
finalURL = domainName
|
||||
|
||||
command = 'wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
##
|
||||
|
||||
@@ -601,26 +610,43 @@ $parameters = array(
|
||||
statusFile.close()
|
||||
|
||||
command = "wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Activating LSCache Plugin,90')
|
||||
statusFile.close()
|
||||
|
||||
command = "wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
|
||||
try:
|
||||
if self.extraArgs['updates']:
|
||||
|
||||
if self.extraArgs['updates'] == 'Disabled':
|
||||
command = "wp config set WP_AUTO_UPDATE_CORE false --raw --allow-root --path=" + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
elif self.extraArgs['updates'] == 'Minor and Security Updates':
|
||||
command = "wp config set WP_AUTO_UPDATE_CORE minor --allow-root --path=" + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
else:
|
||||
command = "wp config set WP_AUTO_UPDATE_CORE true --raw --allow-root --path=" + finalPath
|
||||
ProcessUtilities.executioner(command, externalApp)
|
||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||
|
||||
if result.find('Success:') == -1:
|
||||
raise BaseException(result)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
##
|
||||
@@ -1227,6 +1253,8 @@ $parameters = array(
|
||||
|
||||
def DeployWordPress(self):
|
||||
try:
|
||||
|
||||
if self.extraArgs['createSite']:
|
||||
logging.statusWriter(self.extraArgs['tempStatusPath'], 'Creating this application..,10')
|
||||
|
||||
## Create site
|
||||
@@ -1237,7 +1265,7 @@ $parameters = array(
|
||||
externalApp = "".join(re.findall("[a-zA-Z]+", self.extraArgs['domain']))[:5] + str(randint(1000, 9999))
|
||||
|
||||
virtualHostUtilities.createVirtualHost(self.extraArgs['domain'], self.extraArgs['email'], 'PHP 7.4',
|
||||
externalApp, 0, 1, 0,
|
||||
externalApp, 1, 1, 0,
|
||||
'admin', 'Default', 0, tempStatusPath,
|
||||
0)
|
||||
result = open(tempStatusPath, 'r').read()
|
||||
@@ -1261,9 +1289,8 @@ $parameters = array(
|
||||
|
||||
result = open(self.extraArgs['tempStatusPath'], 'r').read()
|
||||
if result.find('[404]') > -1:
|
||||
logging.statusWriter(self.extraArgs['tempStatusPath'],
|
||||
'Failed to install WordPress. Error: %s [404]' % (result))
|
||||
return 0
|
||||
self.extraArgs['tempStatusPath'] = currentTemp
|
||||
raise BaseException('Failed to install WordPress. Error: %s [404]' % (result))
|
||||
|
||||
self.extraArgs['tempStatusPath'] = currentTemp
|
||||
|
||||
@@ -1306,9 +1333,11 @@ $parameters = array(
|
||||
writeToFile.write('0 12 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/WPAutoUpdates.py\n')
|
||||
writeToFile.close()
|
||||
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
self.extraArgs['websiteName'] = self.extraArgs['domain']
|
||||
from websiteFunctions.website import WebsiteManager
|
||||
wm = WebsiteManager()
|
||||
wm.submitWebsiteDeletion(1, self.extraArgs)
|
||||
logging.statusWriter(self.extraArgs['tempStatusPath'], '%s [404].' % (str(msg)))
|
||||
|
||||
def main():
|
||||
@@ -1326,6 +1355,7 @@ def main():
|
||||
parser.add_argument('--userName', help='')
|
||||
parser.add_argument('--version', help='')
|
||||
parser.add_argument('--path', help='')
|
||||
parser.add_argument('--createSite', help='')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
@@ -1344,6 +1374,7 @@ def main():
|
||||
extraArgs['updates'] = args.updates
|
||||
extraArgs['userName'] = args.userName
|
||||
extraArgs['version'] = args.version
|
||||
extraArgs['createSite'] = int(args.createSite)
|
||||
|
||||
if args.path != None:
|
||||
extraArgs['path'] = args.path
|
||||
|
||||
@@ -1646,6 +1646,14 @@ class backupUtilities:
|
||||
command = "wp search-replace '%s' '%s' --path=%s --allow-root" % (self.extraArgs['sourceDomain'], self.extraArgs['domain'], path)
|
||||
ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
command = "wp search-replace 'www.%s' '%s' --path=%s --allow-root" % (
|
||||
self.extraArgs['sourceDomain'], self.extraArgs['domain'], path)
|
||||
ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
command = "wp search-replace 'www.%s' '%s' --path=%s --allow-root" % (
|
||||
self.extraArgs['domain'], self.extraArgs['domain'], path)
|
||||
ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
|
||||
command = 'rm -rf %s' % (self.extractedPath)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
@@ -50,7 +50,7 @@ class StagingSetup(multi.Thread):
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \
|
||||
" --phpVersion '" + phpSelection + "' --ssl 0 --dkimCheck 0 --openBasedir 0 --path " + path + ' --websiteOwner ' \
|
||||
" --phpVersion '" + phpSelection + "' --ssl 1 --dkimCheck 0 --openBasedir 0 --path " + path + ' --websiteOwner ' \
|
||||
+ admin.userName + ' --tempStatusPath %s' % (tempStatusPath + '1') + " --apache 0"
|
||||
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
Reference in New Issue
Block a user