REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.27 KB
Close
/lib/python3.6/site-packages/up2date_client/statistics.py
Text
Base64
import os from subprocess import PIPE, Popen def get_users_count_from_cllib(): """ Get user count using the common CloudLinux library. This number is more accurate for systems with a control panel installed. """ if not os.path.exists('/opt/cloudlinux/venv/bin'): raise ValueError("CloudLinux virtual environment not found") cmd = '/opt/cloudlinux/venv/bin/python3 -c "from clcommon.cpapi import cpusers; print(cpusers())"' process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) output, errors = [result.decode().strip() for result in process.communicate()] if errors: raise ValueError(f"Failed to get users from CloudLinux library: {errors}") return len(output[1:-1].split(', ')) def get_users_count_generic(): """ Fallback method to get the user count by looking into the /etc/passwd file. """ from up2date_client.clpwd import ClPwd pwd = ClPwd() return len(pwd.get_uid_dict()) def count_server_users(): """ Get the total count of users on the server. Tries the CloudLinux library first, falls back to generic method if it fails. """ try: users_count = get_users_count_from_cllib() except Exception: users_count = get_users_count_generic() return users_count
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2026-05-29 07:17:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
clpwd.py
3.56 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
config.py
13.26 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
hardware.py
5.09 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
pkgplatform.py
309 B
lrw-r--r--
2026-04-27 12:46:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rhncli.py
7.46 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rhnreg.py
10.52 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rhnserver.py
8.54 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rpcServer.py
11.10 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
statistics.py
1.27 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
up2dateAuth.py
10.49 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
up2dateErrors.py
7.99 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
up2dateLog.py
2.06 KB
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
up2dateUtils.py
1.73 KB
lrw-r--r--
2026-04-27 12:46:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
0 B
lrw-r--r--
2026-04-24 15:42:37
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).