PHP 8.2.30
Preview: files.py Size: 933 B
/proc/self/root/proc/thread-self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/clconfigure/files.py

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2024 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# https://cloudlinux.com/docs/LICENCE.TXT
#
import subprocess
from pathlib import Path

from clcommon.lib.consts import CL_EDITION_FILE_FOR_USERS


def remove_cl_edition_file():
    """
    Remove the file that contains the CloudLinux edition
    for end-user access.
    See CLOS-2411 for more info.
    """
    Path(CL_EDITION_FILE_FOR_USERS).unlink(missing_ok=True)


def update_cl_edition_file():
    """
    Populate edition cache again with new edition.
    """
    with subprocess.Popen(
        ['/usr/bin/cldetect', '--detect-edition'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
    ) as proc:
        stdout, _ = proc.communicate()
        if proc.returncode != 0:
            return

    with open(CL_EDITION_FILE_FOR_USERS, 'wb') as f:
        f.write(stdout)

Directory Contents

Dirs: 3 × Files: 12

Name Size Perms Modified Actions
cli DIR
- drwxr-xr-x 2026-04-09 07:00:47
Edit Download
spec DIR
- drwxr-xr-x 2026-04-09 07:00:47
Edit Download
- drwxr-xr-x 2026-04-09 07:05:02
Edit Download
1.75 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
1.81 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
868 B lrw-r--r-- 2026-03-12 11:00:24
Edit Download
933 B lrw-r--r-- 2026-03-12 11:00:24
Edit Download
2.86 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
1.75 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
965 B lrw-r--r-- 2026-03-12 11:00:24
Edit Download
3.18 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
1.61 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
2.29 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
4.94 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
3.09 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).