PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 131
# -*- 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/LICENSE.TXT from __future__ import annotations import logging import os import re from pathlib import Path from typing import List from typing_extensions import TypedDict from packaging.version import InvalidVersion, Version, parse as parse_version from clcommon.clwpos_lib import find_wp_paths, get_wp_cache_plugin from clcommon.cpapi import userdomains, get_main_username_by_uid, get_installed_php_versions, getCPName from clwpos import _ from clwpos.cl_wpos_exceptions import WposError from clwpos.daemon import WposDaemon from clwpos.php.base import PHP from clwpos.scoped_cache import cached_in_scope from clwpos.logsetup import setup_logging from clwpos.utils import ( daemon_communicate, _get_data_from_info_json ) logger = setup_logging(__name__, console_level=logging.WARNING) def _get_doc_roots_info() -> dict: user = get_main_username_by_uid(os.geteuid()) result = {} for domain, doc_root in userdomains(user): result.setdefault(doc_root, []).append(domain) return result def has_wps(username: str) -> bool: """Check if user has at least one WordPress installation""" _info = userdomains(username) # all docroots (like it is done in `_add_wp_path_info`) excludes = list(i[1] for i in _info) for domain, doc_root in _info: wps = list(find_wp_paths(doc_root, excludes=excludes)) # return immediately once first WP installation found if len(wps): return True return False def _add_wp_path_info(user_info: dict) -> dict: wp_paths = {} for doc_root, domains in user_info.items(): # excludes only affects subpaths of doc_root excludes = list(user_info) item = { "domains": domains, "wp_paths": list(find_wp_paths(doc_root, excludes=excludes)), } wp_paths[doc_root] = item return wp_paths _WP_VERSION_RE = re.compile(r"""wp_version\s*=\s*(?:'|")([^"']+)(?:'|")\s*;""", re.MULTILINE) def _get_wp_info_from_version_php_code(content: str) -> str | None: """ Simply search a value of `wp_version` variable in PHP code without evaluation """ match = _WP_VERSION_RE.search(content) try: return match.group(1).strip() if match else None except IndexError: return None def _wp_info(doc_root: str, wp_path: str) -> dict: """Convert WP path to {"path": str, "version": str}""" absolute_wp_path = Path(doc_root, wp_path) version_missing_reason = None version_php = absolute_wp_path / "wp-includes/version.php" try: version_php_code = version_php.read_text("utf-8", errors="ignore") except OSError: version_raw = None version_missing_reason = _("wp-includes/version.php file is missing") else: version_raw = _get_wp_info_from_version_php_code(version_php_code) if not version_raw: version_missing_reason = _("wp-includes/version.php file is invalid") version = None if version_raw: try: version = parse_version(version_raw) except InvalidVersion: version_missing_reason = _("wp-includes/version.php contains invalid identifier") return { "path": wp_path, "version": version, "version_missing_reason": version_missing_reason, } def _add_wp_info(user_info: dict) -> dict: for doc_root, doc_root_info in user_info.items(): wp_paths = doc_root_info.pop("wp_paths") doc_root_info["wps"] = [_wp_info(doc_root, wp_path) for wp_path in wp_paths] return user_info @cached_in_scope def _php_get_vhost_versions(uid): """ uid param is used for caching each distinct uid @return: [ { "account": "rm3", "documentroot": "/home/example/public_html", "version": "ea-php72", "handler": "php-fpm", "vhost": "otherchars.rm3.tld" } ] """ try: return daemon_communicate({"command": WposDaemon.DAEMON_PHP_GET_VHOST_VERSIONS_COMMAND})["data"] except WposError: return _get_data_from_info_json("vhost_versions") def _is_php_selector_applicable(handler): """ 1. If handler is not set to lsphp -> php version selected in PHP Selector will not be applied: https://cloudlinux.zendesk.com/hc/en-us/articles/4414030658962-PHP-Selector-does-not-apply-on-a-server-with-DirectAdmin-panel DirectAdmin PHP Selector could override CloudLinux PHP selector, even loaded .ini could not give 100% So let's do not even try apply selector, if it has no sense """ if getCPName() == 'DirectAdmin' and handler != 'lsapi': return False return True class Info(TypedDict): # e.g. 'user10.com' vhost: str # e.g. 'user10' account: str # e.g. 'system-php72' version: PHP # e.g. 'php-fpm' handler: str # e.g. '/home/user10/public_html' documentroot: str def php_info() -> List[Info]: """ Returns php info, example: [{'vhost': 'sub.wposuser.com', 'account': 'stackoverflow', 'version': 'ea-php80', 'handler': 'php-fpm', 'documentroot': '/home/stackoverflow/public_html'}, ...................................................................] """ installed_php_versions = get_cached_php_installed_versions() vhosts_php_description = _php_get_vhost_versions(os.geteuid()) result = [] for vhost_data in vhosts_php_description: try: php_version = next( version for version in installed_php_versions if version.identifier == vhost_data['version']) except: raise RuntimeError("%s version is not known %s" % ( vhost_data['version'], installed_php_versions)) version_used = php_version if not _is_php_selector_applicable(vhost_data['handler']) \ else php_version.apply_php_selector() result.append(Info( vhost=vhost_data['vhost'], account=vhost_data['account'], version=version_used, handler=vhost_data['handler'], documentroot=vhost_data['documentroot'], )) return result def _add_php(user_info: dict) -> dict: """ Updates user_info dict with php data """ result = php_info() for item in result: if item["documentroot"] not in user_info: logger.warning("Documentroot %(documentroot)s is missing in user information. " "This might indicate that hosting account information was " "changed by the control panel during data processing. " "Usually this is not fatal, try again later and " "contact CloudLinux support if the issue persists.", {'documentroot': item["documentroot"]}) # Skip to the next item in the loop if docroot is not present continue user_info[item["documentroot"]]["php"] = { "version": item["version"], "handler": item["handler"] } return user_info def _add_object_cache_info(user_info: dict) -> dict: """ Search for 'object-cache.php' files in 'wp-content/plugins' directory in order to find what plugin is being used for object caching. """ for doc_root, doc_root_info in user_info.items(): for wp in doc_root_info["wps"]: plugin = get_wp_cache_plugin(Path(doc_root).joinpath(wp["path"]), "object-cache") wp["object_cache"] = plugin return user_info def get_user_info() -> dict: """ Collect info about user. @return { '/home/user/public_html': { 'domains': ['domain.com'], 'wps': [ { 'path': 'wp_path_1', 'version': '5.7.2', 'object_cache': 'redis-cache' }, { 'path': 'wp_path_2', 'version': None, 'object_cache': 'redis-cache' } ], 'php': { 'version': 'ea-php74', 'handler': 'cgi', 'redis_extension': False } } } """ user_info = _get_doc_roots_info() for func in (_add_wp_path_info, _add_wp_info, _add_php): user_info = func(user_info) return user_info def _php_get_installed_versions(): """ @return: [ "ea-php74" ] """ if os.geteuid(): try: return daemon_communicate({ "command": WposDaemon.DAEMON_PHP_GET_INSTALLED_VERSIONS_COMMAND })["data"] except WposError: return _get_data_from_info_json("installed_versions") return get_installed_php_versions() @cached_in_scope def get_cached_php_installed_versions() -> List[PHP]: """ List all installed php version on the system :return: installed php version """ result = _php_get_installed_versions() installed_php_versions = [ PHP( identifier=php_description['identifier'], version=php_description['version'], modules_dir=php_description['modules_dir'], dir=php_description['dir'], bin=php_description['bin'], ini=php_description['ini'] ) for php_description in result ] return installed_php_versions