HEX
Server: Apache
System: Linux panel.gemzo.net 4.18.0-477.10.1.lve.el8.x86_64 #1 SMP Wed May 17 07:12:55 EDT 2023 x86_64
User: birehlibraryps (1007)
PHP: 8.1.28
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //sbin/enable_redis_for_panel_php
#!/opt/alt/python37/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/LICENCE.TXT

import os

from clwpos.object_cache.redis_utils import configurator
from clwpos.optimization_features import OBJECT_CACHE_FEATURE
from clwpos.feature_suites import is_module_allowed_for_user
from clwpos.utils import is_wpos_supported
from clwpos.logsetup import setup_logging


_logger = setup_logging(__name__)


def main():
    """
    Configures redis ext if needed when wpos supported and module is enabled
    """
    if is_wpos_supported() and is_module_allowed_for_user(OBJECT_CACHE_FEATURE):
        try:
            configurator().configure()
        except Exception as e:
            _logger.exception(e)


if __name__ == "__main__":
    main()