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


Python EEFileUtils.mkdir方法代码示例

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


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

示例1: sitebackup

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import mkdir [as 别名]
def sitebackup(self, data):
    ee_site_webroot = data['webroot']
    backup_path = ee_site_webroot + '/backup/{0}'.format(EEVariables.ee_date)
    if not EEFileUtils.isexist(self, backup_path):
        EEFileUtils.mkdir(self, backup_path)
    Log.info(self, "Backup location : {0}".format(backup_path))
    EEFileUtils.copyfile(self, '/etc/nginx/sites-available/{0}'
                         .format(data['site_name']), backup_path)

    if data['currsitetype'] in ['html', 'php', 'mysql']:
        Log.info(self, "Backing up Webroot \t\t", end='')
        EEFileUtils.mvfile(self, ee_site_webroot + '/htdocs', backup_path)
        Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")

    configfiles = glob.glob(ee_site_webroot + '/*-config.php')

    if configfiles and EEFileUtils.isexist(self, configfiles[0]):
        ee_db_name = (EEFileUtils.grep(self, configfiles[0],
                      'DB_NAME').split(',')[1]
                      .split(')')[0].strip().replace('\'', ''))
        Log.info(self, 'Backing up database \t\t', end='')
        EEShellExec.cmd_exec(self, "mysqldump {0} > {1}/{0}.sql"
                             .format(ee_db_name, backup_path),
                             errormsg="\nFailed: Backup Database")
        Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
        # move wp-config.php/ee-config.php to backup
        if data['currsitetype'] in ['mysql']:
            EEFileUtils.mvfile(self, configfiles[0], backup_path)
        else:
            EEFileUtils.copyfile(self, configfiles[0], backup_path)
开发者ID:rahul286,项目名称:easyengine,代码行数:32,代码来源:site_functions.py

示例2: sitebackup

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import mkdir [as 别名]
def sitebackup(self, data):
    ee_site_webroot = data["webroot"]
    backup_path = ee_site_webroot + "/backup/{0}".format(EEVariables.ee_date)
    if not EEFileUtils.isexist(self, backup_path):
        EEFileUtils.mkdir(self, backup_path)
    Log.info(self, "Backup location : {0}".format(backup_path))
    EEFileUtils.copyfile(self, "/etc/nginx/sites-available/{0}".format(data["site_name"]), backup_path)

    if data["currsitetype"] in ["html", "php", "proxy", "mysql"]:
        Log.info(self, "Backing up Webroot \t\t", end="")
        EEFileUtils.mvfile(self, ee_site_webroot + "/htdocs", backup_path)
        Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")

    configfiles = glob.glob(ee_site_webroot + "/*-config.php")
    # if configfiles and EEFileUtils.isexist(self, configfiles[0]):
    #     ee_db_name = (EEFileUtils.grep(self, configfiles[0],
    #                   'DB_NAME').split(',')[1]
    #                   .split(')')[0].strip().replace('\'', ''))
    if data["ee_db_name"]:
        Log.info(self, "Backing up database \t\t", end="")
        try:
            if not EEShellExec.cmd_exec(self, "mysqldump {0} > {1}/{0}.sql".format(data["ee_db_name"], backup_path)):
                Log.info(self, "[" + Log.ENDC + Log.FAIL + "Fail" + Log.OKBLUE + "]")
                raise SiteError("mysqldump failed to backup database")
        except CommandExecutionError as e:
            Log.info(self, "[" + Log.ENDC + "Fail" + Log.OKBLUE + "]")
            raise SiteError("mysqldump failed to backup database")
        Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
        # move wp-config.php/ee-config.php to backup
        if data["currsitetype"] in ["mysql", "proxy"]:
            EEFileUtils.mvfile(self, configfiles[0], backup_path)
        else:
            EEFileUtils.copyfile(self, configfiles[0], backup_path)
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:35,代码来源:site_functions.py


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