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


Python EEFileUtils.grep方法代码示例

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


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

示例1: hashbucket

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
def hashbucket(self):
    # Check Nginx Hashbucket error
    sub = subprocess.Popen('nginx -t', stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE, shell=True)
    output, error_output = sub.communicate()
    if 'server_names_hash_bucket_size' not in str(error_output):
        return True

    count = 0
    # Get the list of sites-availble
    sites_list = os.listdir("/etc/nginx/sites-enabled/")

    # Count the number of characters in site names
    for site in sites_list:
        count = sum([count, len(site)])

    # Calculate Nginx hash bucket size
    ngx_calc = math.trunc(sum([math.log(count, 2), 2]))
    ngx_hash = math.trunc(math.pow(2, ngx_calc))

    # Replace hashbucket in Nginx.conf file
    if EEFileUtils.grep(self, "/etc/nginx/nginx.conf",
                        "server_names_hash_bucket_size"):
        for line in fileinput.FileInput("/etc/nginx/nginx.conf", inplace=1):
            if "server_names_hash_bucket_size" in line:
                print("\tserver_names_hash_bucket_size {0};".format(ngx_hash))
            else:
                print(line, end='')

    elif os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf'):
        if EEFileUtils.grep(self, "/etc/nginx/conf.d/ee-nginx.conf",
                            "server_names_hash_bucket_size"):
            for line in fileinput.FileInput("/etc/nginx/conf.d/ee-nginx.conf",
                                            inplace=1):
                if "server_names_hash_bucket_size" in line:
                    print("server_names_hash_bucket_size {0};"
                          .format(ngx_hash))
                else:
                    print(line, end='')

        else:
            with open('/etc/nginx/conf.d/ee-nginx.conf', 'a') as conf:
                conf.write("server_names_hash_bucket_size {0};\n"
                           .format(ngx_hash))
    else:
        EEFileUtils.searchreplace(self, '/etc/nginx/nginx.conf',
                                  "gzip_disable \"msie6\";",
                                  "gzip_disable \"msie6\";\n"
                                  "\tserver_names_hash_bucket_size {0};\n"
                                  .format(ngx_hash))
开发者ID:dengine,项目名称:easyengine,代码行数:52,代码来源:nginxhashbucket.py

示例2: sync

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
    def sync(self):
        """
        1. reads database information from wp/ee-config.php
        2. updates records into ee database accordingly.
        """
        Log.info(self, "Synchronizing ee database, please wait...")
        sites = getAllsites(self)
        if not sites:
            pass
        for site in sites:
            if site.site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
                ee_site_webroot = site.site_path
                # Read config files
                configfiles = glob.glob(ee_site_webroot + '/*-config.php')
                if configfiles:
                    if EEFileUtils.isexist(self, configfiles[0]):
                        ee_db_name = (EEFileUtils.grep(self, configfiles[0],
                                      'DB_NAME').split(',')[1]
                                      .split(')')[0].strip().replace('\'', ''))
                        ee_db_user = (EEFileUtils.grep(self, configfiles[0],
                                      'DB_USER').split(',')[1]
                                      .split(')')[0].strip().replace('\'', ''))
                        ee_db_pass = (EEFileUtils.grep(self, configfiles[0],
                                      'DB_PASSWORD').split(',')[1]
                                      .split(')')[0].strip().replace('\'', ''))
                        ee_db_host = (EEFileUtils.grep(self, configfiles[0],
                                      'DB_HOST').split(',')[1]
                                      .split(')')[0].strip().replace('\'', ''))

                        # Check if database really exist
                        try:
                            if not EEMysql.check_db_exists(self, ee_db_name):
                                # Mark it as deleted if not exist
                                ee_db_name = 'deleted'
                                ee_db_user = 'deleted'
                                ee_db_pass = 'deleted'
                        except StatementExcecutionError as e:
                            Log.debug(self, str(e))
                        except Exception as e:
                            Log.debug(self, str(e))

                        if site.db_name != ee_db_name:
                            # update records if any mismatch found
                            Log.debug(self, "Updating ee db record for {0}"
                                      .format(site.sitename))
                            updateSiteInfo(self, site.sitename,
                                           db_name=ee_db_name,
                                           db_user=ee_db_user,
                                           db_password=ee_db_pass,
                                           db_host=ee_db_host)
开发者ID:1lwebstudio,项目名称:easyengine,代码行数:52,代码来源:sync.py

示例3: sitebackup

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [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

示例4: upgrade_php56

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
    def upgrade_php56(self):
        if EEVariables.ee_platform_distro == "ubuntu":
            if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}."
                              "list".format(EEVariables.ee_platform_codename)):
                Log.error(self, "Unable to find PHP 5.5")
        else:
            if not(os.path.isfile(EEVariables.ee_repo_file_path) and
                   EEFileUtils.grep(self, EEVariables.ee_repo_file_path,
                                    "php55")):
                Log.error(self, "Unable to find PHP 5.5")

        Log.info(self, "During PHP update process non nginx-cached"
                 " parts of your site may remain down.")

        # Check prompt
        if (not self.app.pargs.no_prompt):
            start_upgrade = input("Do you want to continue:[y/N]")
            if start_upgrade != "Y" and start_upgrade != "y":
                Log.error(self, "Not starting PHP package update")

        if EEVariables.ee_platform_distro == "ubuntu":
            EERepo.remove(self, ppa="ppa:ondrej/php5")
            EERepo.add(self, ppa=EEVariables.ee_php_repo)
        else:
            EEAptGet.remove(self, ["php5-xdebug"])
            EEFileUtils.searchreplace(self, EEVariables.ee_repo_file_path,
                                      "php55", "php56")

        Log.info(self, "Updating apt-cache, please wait...")
        EEAptGet.update(self)
        Log.info(self, "Installing packages, please wait ...")
        if (EEVariables.ee_platform_codename == 'trusty' or EEVariables.ee_platform_codename == 'xenial'):
            EEAptGet.install(self, EEVariables.ee_php5_6 + EEVariables.ee_php_extra)
        else:
            EEAptGet.install(self, EEVariables.ee_php)

        if EEVariables.ee_platform_distro == "debian":
            EEShellExec.cmd_exec(self, "pecl install xdebug")

            with open("/etc/php5/mods-available/xdebug.ini",
                      encoding='utf-8', mode='a') as myfile:
                myfile.write(";zend_extension=/usr/lib/php5/20131226/"
                             "xdebug.so\n")

            EEFileUtils.create_symlink(self, ["/etc/php5/mods-available/"
                                       "xdebug.ini", "/etc/php5/fpm/conf.d"
                                                     "/20-xedbug.ini"])

        Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6")
开发者ID:aalsmile,项目名称:easyengine,代码行数:51,代码来源:stack_upgrade.py

示例5: site_package_check

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
def site_package_check(self, stype):
    apt_packages = []
    packages = []
    stack = EEStackController()
    stack.app = self.app
    if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
                 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for Nginx")

        if not EEAptGet.is_installed(self, 'nginx-custom'):
            apt_packages = apt_packages + EEVariables.ee_nginx
        else:
            # Fix for Nginx white screen death
            if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
                                    'SCRIPT_FILENAME'):
                with open('/etc/nginx/fastcgi_params', encoding='utf-8',
                          mode='a') as ee_nginx:
                    ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
                                   '\t$request_filename;\n')

    if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for PHP")
        if not EEAptGet.is_installed(self, 'php5-fpm'):
            apt_packages = apt_packages + EEVariables.ee_php

    if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for MySQL")
        if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
            apt_packages = apt_packages + EEVariables.ee_mysql
            packages = packages + [["https://raw.githubusercontent.com/"
                                    "major/MySQLTuner-perl/master/"
                                    "mysqltuner.pl", "/usr/bin/mysqltuner",
                                    "MySQLTuner"]]

    if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for Postfix")
        if not EEAptGet.is_installed(self, 'postfix'):
            apt_packages = apt_packages + EEVariables.ee_postfix

    if stype in ['wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting packages variable for WP-CLI")
        if not EEShellExec.cmd_exec(self, "which wp"):
            packages = packages + [["https://github.com/wp-cli/wp-cli/"
                                    "releases/download/v{0}/"
                                    "wp-cli-{0}.phar"
                                    .format(EEVariables.ee_wp_cli),
                                    "/usr/bin/wp", "WP-CLI"]]
    if self.app.pargs.wpredis:
        Log.debug(self, "Setting apt_packages variable for redis")
        if not EEAptGet.is_installed(self, 'redis-server'):
            apt_packages = apt_packages + EEVariables.ee_redis

        if os.path.isfile("/etc/nginx/nginx.conf") and (not
           os.path.isfile("/etc/nginx/common/redis.conf")):

            data = dict()
            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/redis.conf')
            ee_nginx = open('/etc/nginx/common/redis.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'redis.mustache',
                            out=ee_nginx)
            ee_nginx.close()

        if os.path.isfile("/etc/nginx/nginx.conf") and (not
           os.path.isfile("/etc/nginx/common/redis-hhvm.conf")):

            data = dict()
            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/redis-hhvm.conf')
            ee_nginx = open('/etc/nginx/common/redis-hhvm.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'redis-hhvm.mustache',
                            out=ee_nginx)
            ee_nginx.close()

        if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
            if not EEFileUtils.grep(self, "/etc/nginx/conf.d/"
                                    "upstream.conf",
                                    "redis"):
                with open("/etc/nginx/conf.d/upstream.conf",
                          "a") as redis_file:
                    redis_file.write("upstream redis {\n"
                                     "    server 127.0.0.1:6379;\n"
                                     "    keepalive 10;\n}")

        if os.path.isfile("/etc/nginx/nginx.conf") and (not
           os.path.isfile("/etc/nginx/conf.d/redis.conf")):
            with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file:
                redis_file.write("# Log format Settings\n"
                                 "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n"
                                 "'$http_host \"$request\" $status $body_bytes_sent '\n"
                                 "'\"$http_referer\" \"$http_user_agent\"';\n")

    if self.app.pargs.hhvm:
        if platform.architecture()[0] is '32bit':
            Log.error(self, "HHVM is not supported by 32bit system")
        Log.debug(self, "Setting apt_packages variable for HHVM")
        if not EEAptGet.is_installed(self, 'hhvm'):
            apt_packages = apt_packages + EEVariables.ee_hhvm
#.........这里部分代码省略.........
开发者ID:K4Y5,项目名称:easyengine,代码行数:103,代码来源:site_functions.py

示例6: site_package_check

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
def site_package_check(self, stype):
    apt_packages = []
    packages = []
    stack = EEStackController()
    stack.app = self.app
    if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir',
                 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for Nginx")

        if EEVariables.ee_platform_distro == 'debian':
            check_nginx = 'nginx-extras'
        else:
            check_nginx = 'nginx-custom'

        if not EEAptGet.is_installed(self, check_nginx):
            apt_packages = apt_packages + EEVariables.ee_nginx
        else:
            # Fix for Nginx white screen death
            if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
                                    'SCRIPT_FILENAME'):
                with open('/etc/nginx/fastcgi_params', encoding='utf-8',
                          mode='a') as ee_nginx:
                    ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
                                   '\t$request_filename;\n')

    if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for PHP")
        if not EEAptGet.is_installed(self, 'php5-fpm'):
            apt_packages = apt_packages + EEVariables.ee_php

    if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for MySQL")
        if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
            apt_packages = apt_packages + EEVariables.ee_mysql
            packages = packages + [["https://raw.githubusercontent.com/"
                                    "major/MySQLTuner-perl/master/"
                                    "mysqltuner.pl", "/usr/bin/mysqltuner",
                                    "MySQLTuner"]]

    if stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting apt_packages variable for Postfix")
        if not EEAptGet.is_installed(self, 'postfix'):
            apt_packages = apt_packages + EEVariables.ee_postfix

    if stype in ['wp', 'wpsubdir', 'wpsubdomain']:
        Log.debug(self, "Setting packages variable for WP-CLI")
        if not EEShellExec.cmd_exec(self, "which wp"):
            packages = packages + [["https://github.com/wp-cli/wp-cli/"
                                    "releases/download/v{0}/"
                                    "wp-cli-{0}.phar"
                                    .format(EEVariables.ee_wp_cli),
                                    "/usr/bin/wp", "WP-CLI"]]

    if self.app.pargs.hhvm:
        Log.debug(self, "Setting apt_packages variable for HHVM")
        if not EEAptGet.is_installed(self, 'hhvm'):
            apt_packages = apt_packages + EEVariables.ee_hhvm

        if os.path.isdir("/etc/nginx/common") and (not
           os.path.isfile("/etc/nginx/common/php-hhvm.conf")):
            data = dict()
            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/php-hhvm.conf')
            ee_nginx = open('/etc/nginx/common/php-hhvm.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'php-hhvm.mustache',
                            out=ee_nginx)
            ee_nginx.close()

            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/w3tc-hhvm.conf')
            ee_nginx = open('/etc/nginx/common/w3tc-hhvm.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'w3tc-hhvm.mustache', out=ee_nginx)
            ee_nginx.close()

            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/wpfc-hhvm.conf')
            ee_nginx = open('/etc/nginx/common/wpfc-hhvm.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'wpfc-hhvm.mustache',
                            out=ee_nginx)
            ee_nginx.close()

            Log.debug(self, 'Writting the nginx configuration to '
                      'file /etc/nginx/common/wpsc-hhvm.conf')
            ee_nginx = open('/etc/nginx/common/wpsc-hhvm.conf',
                            encoding='utf-8', mode='w')
            self.app.render((data), 'wpsc-hhvm.mustache',
                            out=ee_nginx)
            ee_nginx.close()

        if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
            if not EEFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
                                          "hhvm"):
                with open("/etc/nginx/conf.d/upstream.conf", "a") as hhvm_file:
                    hhvm_file.write("upstream hhvm {\nserver 127.0.0.1:8000;\n"
                                    "server 127.0.0.1:9000 backup;\n}\n")

    # Check if Nginx is allready installed and Pagespeed config there or not
#.........这里部分代码省略.........
开发者ID:gau1991,项目名称:easyengine,代码行数:103,代码来源:site_functions.py

示例7: site_package_check

# 需要导入模块: from ee.core.fileutils import EEFileUtils [as 别名]
# 或者: from ee.core.fileutils.EEFileUtils import grep [as 别名]
def site_package_check(self, stype):
    apt_packages = []
    packages = []
    stack = EEStackController()
    stack.app = self.app
    if stype in ["html", "proxy", "php", "mysql", "wp", "wpsubdir", "wpsubdomain"]:
        Log.debug(self, "Setting apt_packages variable for Nginx")

        # Check if server has nginx-custom package
        if not EEAptGet.is_installed(self, "nginx-custom"):
            # check if Server has nginx-plus installed
            if EEAptGet.is_installed(self, "nginx-plus"):
                # do something
                # do post nginx installation configuration
                Log.info(self, "NGINX PLUS Detected ...")
                apt = ["nginx-plus"] + EEVariables.ee_nginx
                # apt_packages = apt_packages + EEVariables.ee_nginx
                stack.post_pref(apt, packages)

            else:
                apt_packages = apt_packages + EEVariables.ee_nginx
        else:
            # Fix for Nginx white screen death
            if not EEFileUtils.grep(self, "/etc/nginx/fastcgi_params", "SCRIPT_FILENAME"):
                with open("/etc/nginx/fastcgi_params", encoding="utf-8", mode="a") as ee_nginx:
                    ee_nginx.write("fastcgi_param \tSCRIPT_FILENAME " "\t$request_filename;\n")

    if stype in ["php", "mysql", "wp", "wpsubdir", "wpsubdomain"]:
        Log.debug(self, "Setting apt_packages variable for PHP")
        if not EEAptGet.is_installed(self, "php5-fpm"):
            apt_packages = apt_packages + EEVariables.ee_php

    if stype in ["mysql", "wp", "wpsubdir", "wpsubdomain"]:
        Log.debug(self, "Setting apt_packages variable for MySQL")
        if not EEShellExec.cmd_exec(self, "mysqladmin ping"):
            apt_packages = apt_packages + EEVariables.ee_mysql
            packages = packages + [
                [
                    "https://raw.githubusercontent.com/" "major/MySQLTuner-perl/master/" "mysqltuner.pl",
                    "/usr/bin/mysqltuner",
                    "MySQLTuner",
                ]
            ]

    if stype in ["php", "mysql", "wp", "wpsubdir", "wpsubdomain"]:
        Log.debug(self, "Setting apt_packages variable for Postfix")
        if not EEAptGet.is_installed(self, "postfix"):
            apt_packages = apt_packages + EEVariables.ee_postfix

    if stype in ["wp", "wpsubdir", "wpsubdomain"]:
        Log.debug(self, "Setting packages variable for WP-CLI")
        if not EEShellExec.cmd_exec(self, "which wp"):
            packages = packages + [
                [
                    "https://github.com/wp-cli/wp-cli/"
                    "releases/download/v{0}/"
                    "wp-cli-{0}.phar".format(EEVariables.ee_wp_cli),
                    "/usr/bin/wp",
                    "WP-CLI",
                ]
            ]
    if self.app.pargs.wpredis:
        Log.debug(self, "Setting apt_packages variable for redis")
        if not EEAptGet.is_installed(self, "redis-server"):
            apt_packages = apt_packages + EEVariables.ee_redis

        if os.path.isfile("/etc/nginx/nginx.conf") and (not os.path.isfile("/etc/nginx/common/redis.conf")):

            data = dict()
            Log.debug(self, "Writting the nginx configuration to " "file /etc/nginx/common/redis.conf")
            ee_nginx = open("/etc/nginx/common/redis.conf", encoding="utf-8", mode="w")
            self.app.render((data), "redis.mustache", out=ee_nginx)
            ee_nginx.close()

        if os.path.isfile("/etc/nginx/nginx.conf") and (not os.path.isfile("/etc/nginx/common/redis-hhvm.conf")):

            data = dict()
            Log.debug(self, "Writting the nginx configuration to " "file /etc/nginx/common/redis-hhvm.conf")
            ee_nginx = open("/etc/nginx/common/redis-hhvm.conf", encoding="utf-8", mode="w")
            self.app.render((data), "redis-hhvm.mustache", out=ee_nginx)
            ee_nginx.close()

        if os.path.isfile("/etc/nginx/conf.d/upstream.conf"):
            if not EEFileUtils.grep(self, "/etc/nginx/conf.d/" "upstream.conf", "redis"):
                with open("/etc/nginx/conf.d/upstream.conf", "a") as redis_file:
                    redis_file.write("upstream redis {\n" "    server 127.0.0.1:6379;\n" "    keepalive 10;\n}")

        if os.path.isfile("/etc/nginx/nginx.conf") and (not os.path.isfile("/etc/nginx/conf.d/redis.conf")):
            with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file:
                redis_file.write(
                    "# Log format Settings\n"
                    "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n"
                    "'$http_host \"$request\" $status $body_bytes_sent '\n"
                    '\'"$http_referer" "$http_user_agent"\';\n'
                )

    if self.app.pargs.hhvm:
        if platform.architecture()[0] is "32bit":
            Log.error(self, "HHVM is not supported by 32bit system")
        Log.debug(self, "Setting apt_packages variable for HHVM")
#.........这里部分代码省略.........
开发者ID:rjagadishsingh,项目名称:easyengine,代码行数:103,代码来源:site_functions.py


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