%PDF- %PDF-
Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clwpos/ |
Current File : //opt/cloudlinux/venv/lib64/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 # CLWPOS Constants # 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' 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_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-21.el8.cloudlinux" # staging flag same as used in x-ray STAGING_FLAG = '/opt/cloudlinux/staging_mode' LOCAL_API_FLAG = '/opt/cloudlinux/local_api_mode' # https://cl.sentry.cloudlinux.com/organizations/cloudlinux_os/issues/?project=22 SENTRY_DSN = 'https://2ce61b7029e54cb3aae93524e31bd17a:' \ 'bb0501566a894797926d2df17e9050a2@cl.sentry.cloudlinux.com/22' # https://cl.sentry.cloudlinux.com/organizations/cloudlinux_os/issues/?project=38 SENTRY_DNS_TESTING = 'https://5a573a99ce074ab286a59caff2326887:' \ '5a2f45d974924c9c82ee6f106a46391f@cl.sentry.cloudlinux.com/38' CLN_URL = 'https://cln.cloudlinux.com' if os.path.exists(STAGING_FLAG): SENTRY_DSN = SENTRY_DNS_TESTING CLN_URL = 'https://cln-staging.cloudlinux.com' if os.path.exists(LOCAL_API_FLAG): SENTRY_DSN = SENTRY_DNS_TESTING # set up by tests, see QA/robotframework-tests/python_lib/wpos_utils/mock_awp_service/app.py CLN_URL = 'http://127.0.0.1:5000' CLWPOS_OPT_DIR = '/opt/clwpos' CLWPOS_WHMCS_STATS_FILE = os.path.join(CLWPOS_OPT_DIR, 'clwpos-whmcs-stats.json') PUBLIC_OPTIONS_FILE_NAME = 'public_options.json' PUBLIC_OPTIONS = f'{CLWPOS_OPT_DIR}/{PUBLIC_OPTIONS_FILE_NAME}' CLWPOS_VAR_DIR = '/var/clwpos' CLWPOS_ADMIN_DIR = f'{CLWPOS_VAR_DIR}/admin' CLWPOS_UIDS_DIR_NAME = 'uids' CLWPOS_UIDS_PATH = f'{CLWPOS_VAR_DIR}/{CLWPOS_UIDS_DIR_NAME}' 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' AWP_BACKUP_DIR = f'{CLWPOS_VAR_DIR}/.backups' 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'] USERS_CONFIGS_TO_BACKUP = ['clwpos_config.json'] MANAGE_SUITE_IN_CLN_DOC = 'https://docs.cloudlinux.com/cln/dashboard/#acceleratewp-features-management-for-regular-customers' 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