mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
convert to lsws ent via cli
This commit is contained in:
@@ -70,4 +70,9 @@ class cliParser:
|
||||
parser.add_argument('--siteTitle', help='Site Title for application installers.')
|
||||
parser.add_argument('--path', help='Path for application installers.')
|
||||
|
||||
### Convert to LSWS Ent via cli
|
||||
|
||||
parser.add_argument('--licenseKey', help='LiteSpeed Enterprise License key')
|
||||
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -1582,6 +1582,18 @@ def main():
|
||||
wm = WebsiteManager()
|
||||
wm.installJoomla(1, data)
|
||||
|
||||
elif args.function == "switchTOLSWS":
|
||||
|
||||
completeCommandExample = 'cyberpanel switchTOLSWS --licenseKey <Your lsws key here or you can enter TRIAL)'
|
||||
|
||||
if not args.licenseKey:
|
||||
print("\n\nPlease enter LiteSpeed License key. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
from serverStatus.serverStatusUtil import ServerStatusUtil
|
||||
|
||||
ServerStatusUtil.switchTOLSWSCLI(args.licenseKey)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -379,6 +379,34 @@ class ServerStatusUtil:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
ServerStatusUtil.recover()
|
||||
|
||||
@staticmethod
|
||||
def switchTOLSWSCLI(licenseKey):
|
||||
try:
|
||||
|
||||
ServerStatusUtil.switchTOLSWS(licenseKey)
|
||||
|
||||
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if output.find('[404]') > -1:
|
||||
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 0}
|
||||
print(str(data_ret))
|
||||
return 0
|
||||
elif output.find('[200]') > -1:
|
||||
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': 'Successfully converted.', 'installed': 1}
|
||||
print(str(data_ret))
|
||||
return 1
|
||||
else:
|
||||
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
||||
print(output)
|
||||
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='Server Status Util.')
|
||||
|
||||
Reference in New Issue
Block a user