PHP 8.2.30
Preview: trash_cleaner.py Size: 771 B
/proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/lvestats/utils/dbmigrator-back/trash_cleaner.py

#!/usr/bin/env python
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

import os
import glob


def plugins_trash_cleaner(plugins_dir='/usr/share/lve-stats/plugins/'):
    py_mask = os.path.join(plugins_dir, '*.py')
    pyc_mask = py_mask + 'c'

    # clear broken links to py files
    for py_ in glob.glob(py_mask):
        if os.path.islink(py_) and not os.path.exists(os.path.realpath(py_)):
            os.unlink(py_)

    # clear compiled plugins trash
    for pyc_ in glob.glob(pyc_mask):
        if not os.path.exists(pyc_[:-1]):
            os.unlink(pyc_)


if __name__ == '__main__':
    plugins_trash_cleaner()

Directory Contents

Dirs: 2 × Files: 8

Name Size Perms Modified Actions
versions DIR
- drwxr-xr-x 2024-03-03 19:13:18
Edit Download
- drwxr-xr-x 2024-03-03 19:13:18
Edit Download
1.48 KB lrw-r--r-- 2026-03-05 22:36:54
Edit Download
1.40 KB lrw-r--r-- 2026-03-05 22:36:54
Edit Download
752 B lrw-r--r-- 2026-03-05 22:36:54
Edit Download
3.11 KB lrw-r--r-- 2026-03-05 22:36:54
Edit Download
2.50 KB lrw-r--r-- 2026-03-05 22:36:54
Edit Download
693 B lrw-r--r-- 2026-03-05 22:36:54
Edit Download
771 B lrw-r--r-- 2026-03-05 22:36:54
Edit Download
294 B lrw-r--r-- 2026-03-05 22:36:54
Edit Download

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