ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/constants.py

# -*- coding: utf-8 -*-

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2020 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

import os
from enum import Enum

from clcommon.lib.cledition import is_cl_solo_edition
from clcommon.cpapi import CPANEL_NAME, PLESK_NAME, DIRECTADMIN_NAME

# CLWPOS Constants

SUPPORTED_PANELS = (CPANEL_NAME, PLESK_NAME, DIRECTADMIN_NAME)

# Keep it in alphabetical order

ALT_PHP_PREFIX = 'alt-php'
EA_PHP_PREFIX = 'ea-php'
PLESK_PHP_PREFIX = 'plesk-php'
DIRECTADMIN_PREFIX = 'php'

WP_CLI_SKIP_PLUGINS_ENV = 'SKIP_PLUGINS_LOADING'

ALLOWED_MODULES_JSON = 'modules_allowed.json'
ALLOWED_SUITES_JSON = 'suites_allowed.json'
ALT_PHP_REDIS_ENABLE_UTILITY = '/usr/share/cloudlinux/wpos/enable_redis_for_alt_php.py'
PHP_REDIS_ENABLE_UTILITY = '/usr/sbin/enable_redis_for_panel_php'
INSTALL_CACHING_HOOKS_UTILITY = '/usr/share/cloudlinux/wpos/additional_hooks.py'
INSTALL_WPOS_HOOKS_UTILITY = '/usr/share/cloudlinux/wpos/wpos_hooks.py'

WP_CLI = '/opt/clwpos/wp-cli-wrapped'

CAGEFS_ENTER_USER_BIN = '/sbin/cagefs_enter_user'
CLCONFIG_UTILITY = "/usr/sbin/cloudlinux-config"

SMART_ADVISE_USER_UTILITY = '/opt/alt/php-xray/cl-smart-advice-user'
SMART_ADVICE_ROOT_UTILITY = '/usr/sbin/cl-smart-advice'
PULLZONE_DOMAIN_PROTOCOL = 'https://'

DEFAULT_MAX_CACHE_MEMORY = 64
MINIMUM_MAX_CACHE_MEMORY = 16
MAXIMUM_MAX_CACHE_MEMORY = 16384  # 16 GB (in MB)

MINIMUM_SUPPORTED_PHP_OBJECT_CACHE = '7.2'

MINIMUM_SUPPORTED_WP_OBJECT_CACHE = '3.7'
MINIMUM_SUPPORTED_WP_SITE_OPTIMIZATION = '5.2'

MONIROTING_SERVICE = 'clwpos_monitoring'
USER_WPOS_DIR = ".clwpos"
USER_CLWPOS_CONFIG = "clwpos_config.json"

PROJECT_NAME = "accelerate-wp"
PKG_VERSION = "1.9-6.el7.cloudlinux"
PUBLIC_OPTIONS = '/opt/clwpos/public_options.json'

# https://cl.sentry.cloudlinux.com/organizations/cloudlinux_os/issues/?project=22
SENTRY_DSN = 'https://2ce61b7029e54cb3aae93524e31bd17a:' \
             'bb0501566a894797926d2df17e9050a2@cl.sentry.cloudlinux.com/22'

CLWPOS_OPT_DIR = '/opt/clwpos'
CLWPOS_VAR_DIR = '/var/clwpos'
CLWPOS_UIDS_PATH = f'{CLWPOS_VAR_DIR}/uids'
CLWPOS_SOLO_PATH = f'{CLWPOS_VAR_DIR}/solo'
SCANNING_STATUS = f'{CLWPOS_VAR_DIR}/admin/status'
ADMIN_ENABLE_FEATURE_STATUS = f'{CLWPOS_VAR_DIR}/admin/admin_feature_status'
ADMIN_ENABLE_FEATURE_PID = '/var/run/awp_admin_enable_feature.pid'
ADMIN_UPDATE_OBJECT_CACHE_BANNER_PID = '/var/run/awp_admin_update_object_cache_banner.pid'
USERS_PLUGINS_SYNCING_PID = '/var/run/sync_user_plugins_{uid}'
LAST_SCANNED_TS = f'{CLWPOS_VAR_DIR}/admin/last_scan.ts'
SCAN_CACHE = f'{CLWPOS_VAR_DIR}/admin/scan_cache.json'

# staging flag same as used in x-ray
STAGING_FLAG = '/opt/cloudlinux/staging_mode'
CLN_URL = 'https://cln.cloudlinux.com' if not os.path.exists(STAGING_FLAG) \
    else  'https://cln-staging.cloudlinux.com'

CAGEFS_ENTER_UTIL = '/bin/cagefs_enter.proxied'
CAGEFSCTL = '/usr/sbin/cagefsctl'

WPOS_DAEMON_SOCKET_FILE = "/opt/clwpos/wpos_redis_daemon.sock"
REDIS_SERVER_BIN_FILE = '/opt/alt/redis/bin/redis-server'

CLSOP_ZIP_PATH = '/opt/cloudlinux-site-optimization-module/clsop.zip'

# TODO: [unification] doc link is really different
CL_DOC_USER_PLUGIN = 'https://user-docs.solo.cloudlinux.com/wpos-plugin' if is_cl_solo_edition(skip_jwt_check=True) \
    else 'https://user-docs.cloudlinux.com/wpos-plugin'

BASE_ADMIN_DIR = '/var/clwpos/admin'
SUITES_MARKERS = {
    'accelerate_wp_premium': os.path.join(BASE_ADMIN_DIR, 'allowed_for_all_object_cache.flag'),
    'accelerate_wp': os.path.join(BASE_ADMIN_DIR, 'allowed_for_all_site_optimization.flag'),
    'accelerate_wp_cdn': os.path.join(BASE_ADMIN_DIR, 'allowed_for_all_cdn.flag'),
    'accelerate_wp_cdn_pro': os.path.join(BASE_ADMIN_DIR, 'allowed_for_all_cdn_pro.flag')
}

MIGRATION_NEEDED_MARKER = '/var/clwpos/admin/awp_migration_needed.v1'
XRAY_MANAGER_UTILITY = '/usr/sbin/cloudlinux-xray-manager'
XRAY_USER_SOCKET = '/opt/alt/php-xray/run/xray-user.sock'

ON_OFF_IDENTIFIERS = ['on', 'off']


class EnumValue:
    """
    Class to support duplicated values for several names in Enum
    https://stackoverflow.com/questions/31537316/python-enums-with-duplicate-values
    """
    def __init__(self, value):
        self.value = value


class RedisRequiredConstants(Enum):
    """
    Stores all needed redis consts for wp-config
    """
    WP_REDIS_SCHEME = EnumValue('unix')
    WP_REDIS_CLIENT = EnumValue('phpredis')
    WP_REDIS_SELECTIVE_FLUSH = EnumValue('true')
    # those const are custom, they`re rewritten in usage place
    WP_REDIS_PREFIX = EnumValue('CL-')
    WP_REDIS_PATH = EnumValue(None)
    # for graceful error logging, instead of raising exception and failing
    WP_REDIS_GRACEFUL = EnumValue('true')
    WP_REDIS_DISABLE_BANNERS = EnumValue('true')

    @property
    def val(self):
        return self.value.value

Zerion Mini Shell 1.0