- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.117.10.207
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/l.v.e-manager/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/l.v.e-manager/detect_edition_changes.py
#!/opt/cloudlinux/venv/bin/python3 -bb
# coding:utf-8

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

from __future__ import absolute_import
from feature_manager import cpanel_fix_feature_manager, cpanel_remove_from_feature_list
import cldetectlib as detect
from clcommon.lib.cledition import is_cl_shared_edition, get_cl_edition_readable

EDITION_CACHE_FILE = "/var/lve/cl_edition.cache"
DISABLED_FEATURES_FOR_SHARED = {
    "name_list": ["lvewpos"],
    "install_json_list": ["cpanel/wpos/plugin/install.json"]
}

def main():
    """
    Main
    :return: None
    """
    if detect.is_cpanel() and edition_changed():
        process_feature_list()
        return
    print('No action required')

def get_cl_edition_from_cache():
    """
    Red edition from cache file
    :return: String or None
    """
    try:
        with open(EDITION_CACHE_FILE, 'r') as f:
            return f.read()
    except Exception:
        return

def cache_cl_edition(edition):
    """
    Save edition to cache file
    :param edition:
    :return: None
    """
    try:
        with open(EDITION_CACHE_FILE, 'w') as f:
            return f.write(edition)
    except Exception as e:
        print("Cannot cache the edition: {}".format(str(e)))

def edition_changed():
    """
    Detect if edition changed
    :return: Boolean
    """
    current_edition = get_cl_edition_readable()
    cached_edition = get_cl_edition_from_cache()
    if current_edition != cached_edition:
        cache_cl_edition(current_edition)
        return True
    return False

def process_feature_list():
    """
    Fix feature list and disable unsupported features for Shared Edition
    :return: None
    """
    cpanel_fix_feature_manager(DISABLED_FEATURES_FOR_SHARED["install_json_list"])
    if is_cl_shared_edition():
        cpanel_remove_from_feature_list(DISABLED_FEATURES_FOR_SHARED["name_list"])

if __name__ == '__main__':
    main()

Youez - 2016 - github.com/yon3zu
LinuXploit