From 4f2cb9f85ca078a3ef65cc8d8463c197e55f38ff Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 9 Oct 2020 12:04:14 +0500 Subject: [PATCH] install wordpress via cli --- cli/cliParser.py | 6 ++++++ cli/cyberPanel.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/cli/cliParser.py b/cli/cliParser.py index a6e6752b0..20dae31b6 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -63,4 +63,10 @@ class cliParser: parser.add_argument('--securityLevel', help='Set security level while creating user.') parser.add_argument('--state', help='State value used in user suspension.') + + ### WP Install + + parser.add_argument('--siteTitle', help='Site Title for application installers.') + parser.add_argument('--path', help='Path for application installers.') + return parser.parse_args() \ No newline at end of file diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index b04273bf5..82634c4c6 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -1471,6 +1471,51 @@ def main(): print(response.content.decode()) + ### Application installers + + elif args.function == "installWordPress": + completeCommandExample = 'cyberpanel installWordPress --domainName cyberpanel.net --email support@cyberpanel.net --userName cyberpanel --password helloworld --siteTitle "WordPress Site" --path helloworld (this is optional)' + + if not args.domainName: + print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.email: + print("\n\nPlease enter email. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.userName: + print("\n\nPlease enter User name. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.password: + print("\n\nPlease enter password. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.siteTitle: + print("\n\nPlease enter site title. For example:\n\n" + completeCommandExample + "\n\n") + return + + if not args.path: + home = '1' + path = '' + else: + home = '0' + path = args.path + + from websiteFunctions.website import WebsiteManager + + data = {} + data['adminUser'] = args.userName + data['blogTitle'] = args.siteTitle + data['domain'] = args.domainName + data['adminEmail'] = args.email + data['passwordByPass'] = args.password + data['home'] = home + data['path'] = path + + wm = WebsiteManager() + wm.installWordpress(1, data)