$49 GRAYBYTE WORDPRESS FILE MANAGER $28

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/bin/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/bin//generate_accelerate_wp_cache.py
#!/opt/cloudlinux/venv/bin/python3 -sbb

# 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
#

"""
This script is dedicated to save some cache data which we could
obtain fast, instead of iterating many users during our commands
Make sure script is called whatever status is changed to preserve
actual data
"""

import json
import argparse
import os
import logging

from secureio import write_file_via_tempfile
from clwpos.logsetup import setup_logging, init_wpos_sentry_safely
from clwpos.utils import is_wpos_supported, acquire_lock
from clwpos.constants import SUITES_CACHE

from clwpos.feature_suites.configurations import is_module_visible_for_user
from clwpos.optimization_features import ALL_OPTIMIZATION_FEATURES

_logger = setup_logging(
    caller_name='generate_accelerate_wp_cache',
    file_level=logging.INFO,
    logfile_path='/var/log/clwpos/generate_accelerate_wp_cache.log',
)

def generate_suites_statuses_cache():
    """
    Generates cache data for suites statuses
    """

    features_visible_for_any_user = [
        feature for feature in ALL_OPTIMIZATION_FEATURES
        if is_module_visible_for_user(feature)
    ]

    cache = {
        "suites_cache": {
            "ANY": {
                "visible": features_visible_for_any_user,
            }
        }
    }

    _logger.info('Saving cache with content=%s', str(cache))

    write_file_via_tempfile(json.dumps(cache), SUITES_CACHE, 0o600)

if __name__ == '__main__' and is_wpos_supported():
    with acquire_lock(os.path.join('/var/run/generate_accelerate_wp_cache.lock',), attempts=None):
        parser = argparse.ArgumentParser(description="Utility to collect information about user for AccelerateWP")
        parser.add_argument("--suites", default=False, action='store_true')
        args = parser.parse_args()

        init_wpos_sentry_safely()

        if args.suites:
            _logger.info("Generating suites statuses cache")
            try:
                generate_suites_statuses_cache()
            except Exception:
                import traceback
                traceback.print_exc()
                _logger.exception('Failed to generate suites statuses')


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.31 PM
root / root
0755
__pycache__
--
16 Dec 2025 9.31 PM
root / root
0755
__init__.py
0 KB
29 Sep 2025 8.34 PM
root / root
0644
clwpos_collect_information.py
4.525 KB
29 Sep 2025 8.34 PM
root / root
0755
clwpos_uninstall_smart_advice_plugins.py
2.97 KB
29 Sep 2025 8.34 PM
root / root
0755
generate_accelerate_wp_cache.py
2.254 KB
29 Sep 2025 8.34 PM
root / root
0755

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF