[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: configurations.py
File is not writable. Editing disabled.
# -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2022 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT # configurations.py - configuration helpers for AccelerateWP optimization features from pathlib import Path from typing import Optional, Dict, Tuple, Union from clwpos import gettext as _ from clwpos.cl_wpos_exceptions import WposError from clwpos.utils import check_domain, home_dir from clwpos.wp_utils import WordpressError from .features import Feature from ..user.website_check import RollbackException def to_interface_name(feature): return Feature(feature).to_interface_name() def convert_features_dict_to_interface(features_dict): return {to_interface_name(feature): state for feature, state in features_dict.items()} def convert_feature_list_to_interface(features_list): return [to_interface_name(feature) for feature in features_list] class DocRootPath(str): """This class represent path to doc_root.""" pass class DomainName(str): """This class represent domain name.""" pass def disable_without_config_affecting( arg: Union[DocRootPath, DomainName], wp_path: str, *, module: str, domain=None ) -> Optional[WordpressError]: """ Deactivate and delete specified wordpress module. :param arg: user's docroot or domain :param wp_path: path to user's wordpress directory :param module: module on which to perform disable operations :param domain: userdomain :return: error if error was happened else None """ if isinstance(arg, DomainName): doc_root = check_domain(arg)[-1] domain = arg elif isinstance(arg, DocRootPath): doc_root = Path(home_dir(), arg) if not domain: raise ValueError('Domain must be specified') abs_wp_path = str(Path(doc_root).joinpath(wp_path).absolute()) last_error = None errors = Feature(module).disable(abs_wp_path, domain=domain, website=wp_path) if errors: last_error = errors[-1] return last_error def enable_without_config_affecting( arg: Union[DocRootPath, DomainName], wp_path: str, *, module: str, domain=None, ignore_errors=False ) -> Tuple[bool, Dict[str, Union[str, dict]]]: """ Install and activate specified wordpress module. :param arg: user's docroot or domain :param wp_path: path to user's wordpress directory :param module: module on which to perform enable operations :param domain: userdomain :param ignore_errors: if True, skip additional checks during enabling :return: tuple that consists of enabling status and details """ if isinstance(arg, DomainName): __, doc_root = check_domain(arg) domain = arg elif isinstance(arg, DocRootPath): doc_root = Path(home_dir(), arg) if not domain: raise ValueError('Domain must be specified') else: raise ValueError("Invalid argument format") wp_path = wp_path.lstrip("/") abs_wp_path = str(Path(doc_root).joinpath(wp_path).absolute()) # try to install plugin feature = Feature(module) try: feature.install(abs_wp_path) except WposError as e: return False, dict( message=_("WordPress plugin installation failed. " "Try again and contact your system administrator if issue persists."), details=e.message, context=e.context ) # try to activate plugin try: feature.enable(abs_wp_path, domain=domain, website=wp_path, skip_checkers=ignore_errors) except WposError as e: feature.disable(abs_wp_path, domain=domain, website=wp_path) if isinstance(e, RollbackException): return False, { 'context': e.context, 'result': e.message, 'issues': e.errors } return False, dict( message=_("WordPress plugin activation failed. Changes were reverted and caching module is now disabled. " "Try again and contact your system administrator if issue persists."), details=e.message, context=e.context ) return True, {}
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 690.91 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A