!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/optimization_features/   drwxr-xr-x
Free 293.98 GB of 429.69 GB (68.42%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     configurations.py (4.1 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- 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)

    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, {}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.1009 ]--