当前位置: 首页>>代码示例>>Python>>正文


Python EEFileUtils.chdir方法代码示例

本文整理汇总了Python中ee.core.fileutils.EEFileUtils.chdir方法的典型用法代码示例。如果您正苦于以下问题:Python EEFileUtils.chdir方法的具体用法?Python EEFileUtils.chdir怎么用?Python EEFileUtils.chdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ee.core.fileutils.EEFileUtils的用法示例。


在下文中一共展示了EEFileUtils.chdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: updatewpuserpassword

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def updatewpuserpassword(self, ee_domain, ee_site_webroot):

    ee_wp_user = ""
    ee_wp_pass = ""
    EEFileUtils.chdir(self, "{0}/htdocs/".format(ee_site_webroot))

    # Check if ee_domain is wordpress install
    try:
        is_wp = EEShellExec.cmd_exec(self, "wp --allow-root core" " version")
    except CommandExecutionError as e:
        raise SiteError("is wordpress site? check command failed ")

    # Exit if ee_domain is not wordpress install
    if not is_wp:
        Log.error(self, "{0} does not seem to be a WordPress site".format(ee_domain))

    try:
        ee_wp_user = input("Provide WordPress user name [admin]: ")
    except Exception as e:
        Log.debug(self, "{0}".format(e))
        Log.error(self, "\nCould not update password")

    if ee_wp_user == "?":
        Log.info(self, "Fetching WordPress user list")
        try:
            EEShellExec.cmd_exec(self, "wp --allow-root user list " "--fields=user_login | grep -v user_login")
        except CommandExecutionError as e:
            raise SiteError("fetch wp userlist command failed")

    if not ee_wp_user:
        ee_wp_user = "admin"

    try:
        is_user_exist = EEShellExec.cmd_exec(
            self, "wp --allow-root user list " "--fields=user_login | grep {0}$ ".format(ee_wp_user)
        )
    except CommandExecutionError as e:
        raise SiteError("if wp user exists check command failed")

    if is_user_exist:
        try:
            ee_wp_pass = getpass.getpass(prompt="Provide password for " "{0} user: ".format(ee_wp_user))

            while not ee_wp_pass:
                ee_wp_pass = getpass.getpass(prompt="Provide password for " "{0} user: ".format(ee_wp_user))
        except Exception as e:
            Log.debug(self, "{0}".format(e))
            raise SiteError("failed to read password input ")

        try:
            EEShellExec.cmd_exec(
                self, "wp --allow-root user update {0}" "  --user_pass={1}".format(ee_wp_user, ee_wp_pass)
            )
        except CommandExecutionError as e:
            raise SiteError("wp user password update command failed")
        Log.info(self, "Password updated successfully")

    else:
        Log.error(self, "Invalid WordPress user {0} for {1}.".format(ee_wp_user, ee_domain))
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:61,代码来源:site_functions.py

示例2: uninstallwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def uninstallwp_plugin(self, plugin_name, data):
    ee_site_webroot = data['webroot']
    Log.debug(self, "Uninstalling plugin {0}".format(plugin_name))
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin --allow-root uninstall "
                         "{0}".format(plugin_name),
                         errormsg="Unable to UnInstall plugin {0}"
                         .format(plugin_name))
开发者ID:rahul286,项目名称:easyengine,代码行数:10,代码来源:site_functions.py

示例3: setupwordpressnetwork

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwordpressnetwork(self, data):
    ee_site_webroot = data['webroot']
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    Log.info(self, "Setting up WordPress Network \t", end='')
    EEShellExec.cmd_exec(self, 'wp --allow-root core multisite-convert'
                         ' --title=\'{0}\' {subdomains}'
                         .format(data['www_domain'], subdomains='--subdomains'
                                 if not data['wpsubdir'] else ''))
    Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
开发者ID:rahul286,项目名称:easyengine,代码行数:11,代码来源:site_functions.py

示例4: updatewpuserpassword

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def updatewpuserpassword(self, ee_domain, ee_site_webroot):

    ee_wp_user = ''
    ee_wp_pass = ''
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))

    # Check if ee_domain is wordpress install
    is_wp = EEShellExec.cmd_exec(self, "wp --allow-root core"
                                 " version",
                                 errormsg="{0} : Unable to check if wp install"
                                 .format(ee_domain))

    # Exit if ee_domain is not wordpress install
    if not is_wp:
        Log.error(self, "{0} does not seem to be a WordPress site"
                  .format(ee_domain))

    try:
        ee_wp_user = input("Provide WordPress user name [admin]: ")
    except Exception as e:
        Log.debug(self, "{0}".format(e))
        Log.error(self, "\nCould not update password")

    if ee_wp_user == "?":
        Log.info(self, "Fetching WordPress user list")
        EEShellExec.cmd_exec(self, "wp --allow-root user list "
                             "--fields=user_login | grep -v user_login",
                             errormsg="Unable to Fetch users list")

    if not ee_wp_user:
        ee_wp_user = 'admin'

    is_user_exist = EEShellExec.cmd_exec(self, "wp --allow-root user list "
                                         "--fields=user_login | grep {0}$ "
                                         .format(ee_wp_user))

    if is_user_exist:
        try:
            ee_wp_pass = getpass.getpass(prompt="Provide password for "
                                         "{0} user: "
                                         .format(ee_wp_user))
        except Exception as e:
            Log.debug(self, "{0}".format(e))
            Log.error(self, "Could not update password")

        if len(ee_wp_pass) > 8:
            EEShellExec.cmd_exec(self, "wp --allow-root user update {0}"
                                 "  --user_pass={1}"
                                 .format(ee_wp_user, ee_wp_pass))
            Log.info(self, "Password updated successfully")
        else:
            Log.error(self, "Password Unchanged. Hint : Your password must be "
                      "8 characters long")
    else:
        Log.error(self, "Invalid WordPress user {0} for {1}."
                  .format(ee_wp_user, ee_domain))
开发者ID:rahul286,项目名称:easyengine,代码行数:58,代码来源:site_functions.py

示例5: uninstallwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def uninstallwp_plugin(self, plugin_name, data):
    ee_site_webroot = data['webroot']
    Log.debug(self, "Uninstalling plugin {0}, please wait..."
              .format(plugin_name))
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    try:
        EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin "
                             "--allow-root uninstall "
                             "{0}".format(plugin_name))
    except CommandExecutionError as e:
        raise SiteError("plugin uninstall failed")
开发者ID:dengine,项目名称:easyengine,代码行数:13,代码来源:site_functions.py

示例6: setupwordpressnetwork

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwordpressnetwork(self, data):
    ee_site_webroot = data['webroot']
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    Log.info(self, "Setting up WordPress Network \t", end='')
    try:
        EEShellExec.cmd_exec(self, 'wp --allow-root core multisite-convert'
                             ' --title=\'{0}\' {subdomains}'
                             .format(data['www_domain'],
                                     subdomains='--subdomains'
                                     if not data['wpsubdir'] else ''))
    except CommandExecutionError as e:
        Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
        raise SiteError("setup wordpress network failed")
    Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
开发者ID:K4Y5,项目名称:easyengine,代码行数:16,代码来源:site_functions.py

示例7: installwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def installwp_plugin(self, plugin_name, data):
    ee_site_webroot = data['webroot']
    Log.info(self, "Installing plugin {0}".format(plugin_name))
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin --allow-root install "
                         "{0}".format(plugin_name),
                         errormsg="Unable to Install plugin {0}"
                         .format(plugin_name))

    EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin --allow-root activate "
                         "{0} {na}"
                         .format(plugin_name,
                                 na='--network' if data['multisite'] else ''),
                         errormsg="Unable to Activate plugin {0}"
                         .format(plugin_name))
开发者ID:rahul286,项目名称:easyengine,代码行数:17,代码来源:site_functions.py

示例8: uninstallwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def uninstallwp_plugin(self, plugin_name, data):
    ee_site_webroot = data["webroot"]
    Log.debug(self, "Uninstalling plugin {0}, please wait...".format(plugin_name))
    EEFileUtils.chdir(self, "{0}/htdocs/".format(ee_site_webroot))
    Log.info(self, "Uninstalling plugin {0}, please wait...".format(plugin_name))
    try:
        EEShellExec.cmd_exec(
            self,
            "php {0} plugin ".format(EEVariables.ee_wpcli_path) + "--allow-root deactivate " "{0}".format(plugin_name),
        )

        EEShellExec.cmd_exec(
            self,
            "php {0} plugin ".format(EEVariables.ee_wpcli_path) + "--allow-root uninstall " "{0}".format(plugin_name),
        )
    except CommandExecutionError as e:
        raise SiteError("plugin uninstall failed")
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:19,代码来源:site_functions.py

示例9: setupwordpressnetwork

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwordpressnetwork(self, data):
    ee_site_webroot = data["webroot"]
    EEFileUtils.chdir(self, "{0}/htdocs/".format(ee_site_webroot))
    Log.info(self, "Setting up WordPress Network \t", end="")
    try:
        if EEShellExec.cmd_exec(
            self,
            "wp --allow-root core multisite-convert"
            " --title='{0}' {subdomains}".format(
                data["www_domain"], subdomains="--subdomains" if not data["wpsubdir"] else ""
            ),
        ):
            pass
        else:
            Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
            raise SiteError("setup wordpress network failed")

    except CommandExecutionError as e:
        Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
        raise SiteError("setup wordpress network failed")
    Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:23,代码来源:site_functions.py

示例10: installwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def installwp_plugin(self, plugin_name, data):
    ee_site_webroot = data['webroot']
    Log.info(self, "Installing plugin {0}, please wait..."
             .format(plugin_name))
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    try:
        EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin "
                             "--allow-root install "
                             "{0}".format(plugin_name))
    except CommandExecutionError as e:
        raise SiteError("plugin installation failed")

    try:
        EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin "
                             "--allow-root activate "
                             "{0} {na}"
                             .format(plugin_name,
                                     na='--network' if data['multisite']
                                     else ''
                                     ))
    except CommandExecutionError as e:
        raise SiteError("plugin activation failed")
开发者ID:dengine,项目名称:easyengine,代码行数:24,代码来源:site_functions.py

示例11: installwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def installwp_plugin(self, plugin_name, data):
    ee_site_webroot = data["webroot"]
    Log.info(self, "Installing plugin {0}, please wait...".format(plugin_name))
    EEFileUtils.chdir(self, "{0}/htdocs/".format(ee_site_webroot))
    try:
        EEShellExec.cmd_exec(
            self,
            "php {0} plugin ".format(EEVariables.ee_wpcli_path) + "--allow-root install " "{0}".format(plugin_name),
        )
    except CommandExecutionError as e:
        raise SiteError("plugin installation failed")

    try:
        EEShellExec.cmd_exec(
            self,
            "php {0} plugin ".format(EEVariables.ee_wpcli_path) + "--allow-root activate "
            "{0} {na}".format(plugin_name, na="--network" if data["multisite"] else ""),
        )
    except CommandExecutionError as e:
        raise SiteError("plugin activation failed")

    return 1
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:24,代码来源:site_functions.py

示例12: cd

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
    def cd(self):
        if not self.app.pargs.site_name:
            try:
                while not self.app.pargs.site_name:
                    self.app.pargs.site_name = (input('Enter site name : ')
                                                .strip())
            except IOError as e:
                Log.error(self, 'Unable to read input, please try again')

        self.app.pargs.site_name = self.app.pargs.site_name.strip()
        (ee_domain, ee_www_domain) = ValidateDomain(self.app.pargs.site_name)

        if not check_domain_exists(self, ee_domain):
            Log.error(self, "site {0} does not exist".format(ee_domain))

        ee_site_webroot = getSiteInfo(self, ee_domain).site_path
        EEFileUtils.chdir(self, ee_site_webroot)

        try:
            subprocess.call(['bash'])
        except OSError as e:
            Log.debug(self, "{0}{1}".format(e.errno, e.strerror))
            Log.error(self, "unable to change directory")
开发者ID:etokareva,项目名称:easyengine,代码行数:25,代码来源:site.py

示例13: setupwp_plugin

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwp_plugin(self, plugin_name, plugin_option, plugin_data, data):
    ee_site_webroot = data["webroot"]
    Log.info(self, "Setting plugin {0}, please wait...".format(plugin_name))
    EEFileUtils.chdir(self, "{0}/htdocs/".format(ee_site_webroot))

    if not data["multisite"]:
        try:
            EEShellExec.cmd_exec(
                self,
                "php {0} ".format(EEVariables.ee_wpcli_path) + "--allow-root option update "
                "{0} '{1}' --format=json".format(plugin_option, plugin_data),
            )
        except CommandExecutionError as e:
            raise SiteError("plugin setup failed")
    else:
        try:
            EEShellExec.cmd_exec(
                self,
                "php {0} ".format(EEVariables.ee_wpcli_path) + "--allow-root network meta update 1 "
                "{0} '{1}' --format=json".format(plugin_option, plugin_data),
            )
        except CommandExecutionError as e:
            raise SiteError("plugin setup failed")
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:25,代码来源:site_functions.py

示例14: setupwordpress

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwordpress(self, data):
    ee_domain_name = data['site_name']
    ee_site_webroot = data['webroot']
    prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
    ee_wp_user = self.app.config.get('wordpress', 'user')
    ee_wp_pass = self.app.config.get('wordpress', 'password')
    ee_wp_email = self.app.config.get('wordpress', 'email')
    # Random characters
    ee_random = (''.join(random.sample(string.ascii_uppercase +
                 string.ascii_lowercase + string.digits, 15)))
    ee_wp_prefix = ''
    # ee_wp_user = ''
    # ee_wp_pass = ''

    if 'wp-user' in data.keys() and data['wp-user']:
        ee_wp_user = data['wp-user']
    if 'wp-email' in data.keys() and data['wp-email']:
        ee_wp_email = data['wp-email']
    if 'wp-pass' in data.keys() and data['wp-pass']:
        ee_wp_pass = data['wp-pass']

    Log.info(self, "Downloading Wordpress \t\t", end='')
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    try:
        EEShellExec.cmd_exec(self, "wp --allow-root core"
                             " download")
    except CommandExecutionError as e:
        Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
        raise SiteError(self, "download wordpress core failed")

    Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")

    if not (data['ee_db_name'] and data['ee_db_user'] and data['ee_db_pass']):
        data = setupdatabase(self, data)
    if prompt_wpprefix == 'True' or prompt_wpprefix == 'true':
        try:
            ee_wp_prefix = input('Enter the WordPress table prefix [wp_]: ')
            while not re.match('^[A-Za-z0-9_]*$', ee_wp_prefix):
                Log.warn(self, "table prefix can only "
                         "contain numbers, letters, and underscores")
                ee_wp_prefix = input('Enter the WordPress table prefix [wp_]: '
                                     )
        except EOFError as e:
            Log.debug(self, "{0}".format(e))
            raise SiteError("input table prefix failed")

    if not ee_wp_prefix:
        ee_wp_prefix = 'wp_'

    # Modify wp-config.php & move outside the webroot

    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    Log.debug(self, "Setting up wp-config file")
    if not data['multisite']:
        Log.debug(self, "Generating wp-config for WordPress Single site")
        Log.debug(self, "bash -c \"php {0} --allow-root "
                  .format(EEVariables.ee_wpcli_path)
                  + "core config "
                  + "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbuser=\'{2}\' "
                  "--dbhost=\'{3}\' "
                  .format(data['ee_db_name'], ee_wp_prefix,
                          data['ee_db_user'], data['ee_db_host'])
                  + "--dbpass= "
                  "--extra-php<<PHP \n {1}\nPHP\""
                  .format(data['ee_db_pass'],
                          "\n\ndefine(\'WP_DEBUG\', false);"))
        try:
            EEShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root"
                                 .format(EEVariables.ee_wpcli_path)
                                 + " core config "
                                 + "--dbname=\'{0}\' --dbprefix=\'{1}\' "
                                 "--dbuser=\'{2}\' --dbhost=\'{3}\' "
                                 .format(data['ee_db_name'], ee_wp_prefix,
                                         data['ee_db_user'], data['ee_db_host']
                                         )
                                 + "--dbpass=\'{0}\' "
                                   "--extra-php<<PHP \n {1}\nPHP\""
                                   .format(data['ee_db_pass'],
                                           "\n\ndefine(\'WP_DEBUG\', false);"),
                                   log=False
                                 )
        except CommandExecutionError as e:
                raise SiteError("generate wp-config failed for wp single site")
    else:
        Log.debug(self, "Generating wp-config for WordPress multisite")
        Log.debug(self, "bash -c \"php {0} --allow-root "
                  .format(EEVariables.ee_wpcli_path)
                  + "core config "
                  + "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
                  .format(data['ee_db_name'], ee_wp_prefix, data['ee_db_host'])
                  + "--dbuser=\'{0}\' --dbpass= "
                  "--extra-php<<PHP \n {2} {3} {4}\nPHP\""
                  .format(data['ee_db_user'], data['ee_db_pass'],
                          "\ndefine(\'WP_ALLOW_MULTISITE\', "
                          "true);",
                          "\ndefine(\'WPMU_ACCEL_REDIRECT\',"
                          " true);",
                          "\n\ndefine(\'WP_DEBUG\', false);"))
        try:
            EEShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root"
#.........这里部分代码省略.........
开发者ID:K4Y5,项目名称:easyengine,代码行数:103,代码来源:site_functions.py

示例15: setupwordpress

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import chdir [as 别名]
def setupwordpress(self, data):
    ee_domain_name = data['site_name']
    ee_site_webroot = data['webroot']
    prompt_wpprefix = self.app.config.get('wordpress', 'prefix')
    ee_wp_user = self.app.config.get('wordpress', 'user')
    ee_wp_pass = self.app.config.get('wordpress', 'password')
    ee_wp_email = self.app.config.get('wordpress', 'email')
    # Random characters
    ee_random = (''.join(random.sample(string.ascii_uppercase +
                 string.ascii_lowercase + string.digits, 15)))
    ee_wp_prefix = ''
    # ee_wp_user = ''
    # ee_wp_pass = ''

    Log.info(self, "Downloading Wordpress \t\t", end='')
    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    EEShellExec.cmd_exec(self, "wp --allow-root core download")
    Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")

    if not (data['ee_db_name'] and data['ee_db_user'] and data['ee_db_pass']):
        data = setupdatabase(self, data)
    if prompt_wpprefix == 'True' or prompt_wpprefix == 'true':
        try:
            ee_wp_prefix = input('Enter the WordPress table prefix [wp_]: ')
            while not re.match('^[A-Za-z0-9_]*$', ee_wp_prefix):
                Log.warn(self, "table prefix can only "
                         "contain numbers, letters, and underscores")
                ee_wp_prefix = input('Enter the WordPress table prefix [wp_]: '
                                     )
        except EOFError as e:
            Log.debug(self, "{0}".format(e))
            Log.error(self, "Unable to input table prefix")

    if not ee_wp_prefix:
        ee_wp_prefix = 'wp_'

    # Modify wp-config.php & move outside the webroot

    EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
    Log.debug(self, "Setting up wp-config file")
    if not data['multisite']:
        Log.debug(self, "Generating wp-config for WordPress Single site")
        Log.debug(self, "bash -c \"php /usr/bin/wp --allow-root "
                  + "core config "
                  + "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbuser=\'{2}\' "
                  "--dbhost=\'{3}\' "
                  .format(data['ee_db_name'], ee_wp_prefix,
                          data['ee_db_user'], data['ee_db_host'])
                  + "--dbpass= "
                  "--extra-php<<PHP \n {1}\nPHP\""
                  .format(data['ee_db_pass'],
                          "\n\ndefine(\'WP_DEBUG\', false);"))
        EEShellExec.cmd_exec(self, "bash -c \"php /usr/bin/wp --allow-root "
                             + "core config "
                             + "--dbname=\'{0}\' --dbprefix=\'{1}\' "
                             "--dbuser=\'{2}\' --dbhost=\'{3}\' "
                             .format(data['ee_db_name'], ee_wp_prefix,
                                     data['ee_db_user'], data['ee_db_host'])
                             + "--dbpass=\'{0}\' "
                               "--extra-php<<PHP \n {1}\nPHP\""
                               .format(data['ee_db_pass'],
                                       "\n\ndefine(\'WP_DEBUG\', false);"),
                               log=False
                             ) or Log.error(self,
                                            "Unable to Generate "
                                            "wp-config")
    else:
        Log.debug(self, "Generating wp-config for WordPress multisite")
        Log.debug(self, "bash -c \"php /usr/bin/wp --allow-root "
                  + "core config "
                  + "--dbname=\'{0}\' --dbprefix=\'{1}\' --dbhost=\'{2}\' "
                  .format(data['ee_db_name'], ee_wp_prefix, data['ee_db_host'])
                  + "--dbuser=\'{0}\' --dbpass= "
                  "--extra-php<<PHP \n {2} {3} {4}\nPHP\""
                  .format(data['ee_db_user'], data['ee_db_pass'],
                          "\ndefine(\'WP_ALLOW_MULTISITE\', "
                          "true);",
                          "\ndefine(\'WPMU_ACCEL_REDIRECT\',"
                          " true);",
                          "\n\ndefine(\'WP_DEBUG\', false);"))
        EEShellExec.cmd_exec(self, "bash -c \"php /usr/bin/wp --allow-root "
                             + "core config "
                             + "--dbname=\'{0}\' --dbprefix=\'{1}\' "
                             "--dbhost=\'{2}\' "
                             .format(data['ee_db_name'], ee_wp_prefix,
                                     data['ee_db_host'])
                             + "--dbuser=\'{0}\' --dbpass=\'{1}\' "
                               "--extra-php<<PHP \n {2} {3} {4}\nPHP\""
                             .format(data['ee_db_user'], data['ee_db_pass'],
                                     "\ndefine(\'WP_ALLOW_MULTISITE\', "
                                     "true);",
                                     "\ndefine(\'WPMU_ACCEL_REDIRECT\',"
                                     " true);",
                                     "\n\ndefine(\'WP_DEBUG\', false);"),
                             log=False
                             ) or Log.error(self,
                                            "Unable to Generate "
                                            "wp-config")
    EEFileUtils.mvfile(self, os.getcwd()+'/wp-config.php',
                       os.path.abspath(os.path.join(os.getcwd(), os.pardir)))
#.........这里部分代码省略.........
开发者ID:rahul286,项目名称:easyengine,代码行数:103,代码来源:site_functions.py


注:本文中的ee.core.fileutils.EEFileUtils.chdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。