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 -*- import json import logging # 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 import os import pwd from typing import List from clcommon import cpapi from clcommon.clpwd import drop_privileges from clwpos.constants import CLWPOS_WHMCS_STATS_FILE from clwpos.logsetup import setup_logging from clwpos.optimization_features import ALL_OPTIMIZATION_FEATURES from clwpos.feature_suites import ( get_allowed_modules, get_visible_modules, get_allowed_suites, PremiumSuite, ALL_SUITES, AWPSuite ) from clwpos.utils import get_server_wide_options from clwpos.user.config import UserConfig from clwpos.feature_suites import CDNSuitePro _logger = setup_logging('clwpos_statistics') def get_sites_count_with_enabled_wpos_statistics(user: str, checked_modules: List[str]) -> int: """ Calculates total count of sites with at least one enabled module per user """ count = 0 try: with drop_privileges(user): uc = UserConfig(user) count = uc.get_enabled_sites_count_by_modules(checked_modules) except Exception as e: _logger.warning('Error while getting info from clwpos user config %s', str(e)) return count return count def is_module_allowed_for_user(user: str, checked_modules: List[str]) -> int: """ Checks if there are any allowed modules for user """ try: uid = pwd.getpwnam(user).pw_uid except KeyError: _logger.debug('Unable to get uid for %s', user) return False allowed_modules = get_allowed_modules(uid) return any(checked_module in allowed_modules for checked_module in checked_modules) def is_module_visible_for_user(user: str, checked_modules: List[str]) -> int: """ Checks if there are any visible modules for user """ try: uid = pwd.getpwnam(user).pw_uid except KeyError: _logger.debug('Unable to get uid for %s', user) return False visible_modules = get_visible_modules(uid) return any(checked_module in visible_modules for checked_module in checked_modules) def is_suite_allowed_for_user(user: str, suites: List[str]) -> int: try: uid = pwd.getpwnam(user).pw_uid except KeyError: _logger.debug('Unable to get uid for %s', user) return False allowed_suites = get_allowed_suites(uid) return any(checked_suite in allowed_suites for checked_suite in suites) def _get_wpos_statistics_total_count( modules: List[str], kind: str = 'allowed', allowed_by_modules=False, allowed_by_suites: List[str] = None, per_user=False ): """ Returns total count of users with allowed wpos module or total count of sites with enabled wpos module for all panel users on server """ total_count = 0 panel_users = cpapi.cpusers() for user in panel_users: if allowed_by_modules and not is_module_allowed_for_user(user, modules): continue if allowed_by_suites is not None and not is_suite_allowed_for_user(user, allowed_by_suites): continue if kind == 'allowed': total_count += 1 elif kind == 'visible': if is_module_visible_for_user(user, modules): total_count += 1 else: if per_user: total_count += bool(get_sites_count_with_enabled_wpos_statistics(user, modules)) else: total_count += get_sites_count_with_enabled_wpos_statistics(user, modules) return total_count def _get_premium_potential_upgrades_statistics(): """ """ panel_users = cpapi.cpusers() visible_premium = 0 disallowed_premium = 0 for user in panel_users: # skip users that do not have accelerate wp free enabled if not get_sites_count_with_enabled_wpos_statistics(user, AWPSuite.feature_set): continue if is_module_visible_for_user(user, PremiumSuite.feature_set): # if any of the modules are already installed, that is not what we are looking for if get_sites_count_with_enabled_wpos_statistics(user, PremiumSuite.feature_set): continue visible_premium += 1 else: disallowed_premium += 1 return visible_premium, disallowed_premium def _get_wpos_statistics_active_count(suite: str, features_by_license=None): """ Returns total count of users with active wpos module. """ total_count = 0 panel_users = cpapi.cpusers() for user in panel_users: if not is_suite_allowed_for_user(user, [suite]): continue counted_features = list(ALL_SUITES[suite].primary_features) if features_by_license == 'billable': counted_features = list(ALL_SUITES[suite].billable_features) elif features_by_license == 'non_billable': counted_features = list(ALL_SUITES[suite].non_billable_features()) if get_sites_count_with_enabled_wpos_statistics( user, counted_features): total_count += 1 return total_count def is_accelerate_wp_icon_enabled(): """ Obtains admin`s options, e.g show_icon """ try: options = get_server_wide_options() except Exception as e: _logger.error('Error when getting admin options: %s', str(e)) return -42 return options.show_icon def _read_whmcs_statistics(): """ Reads whmcs statistics file and returns data as dictionary. """ try: with open(CLWPOS_WHMCS_STATS_FILE, 'r') as f: raw_data = f.read() except FileNotFoundError: # when file does not exists, it's fine return None try: data = json.loads(raw_data) except (json.JSONDecodeError, ValueError): logging.error('Malformed whmcs data: %s', raw_data) return None return data def fill_current_wpos_statistics(): """ Returns current statistics with enabled sites/allowed users counters per module and in total """ # this flag is kept only for backwards compatibility # and does not mean anything specific anymore is_feature_flag = os.path.isfile('/var/lve/enable-wpos.flag') is_feature_icon_enabled = is_accelerate_wp_icon_enabled() disabled_status = {True: 'disabled', False: 'enabled', None: 'none'} server_wide_options = get_server_wide_options() awp_enabled_visible_premium, awp_enabled_disallowed_premium = ( _get_premium_potential_upgrades_statistics()) result = { 'allowed_users': dict(), # total: # object_cache: # site_optimization: 'allowed_suites': dict(), # total: # premium: # cdn # cdn_pro: 'enabled_suites': dict(), # total: # premium: # cdn # cdn_pro: 'visible_users': dict(), # total: # object_cache: # site_optimization: 'enabled_sites': dict(), # total: # object_cache: # site_optimization: 'enabled_users': dict(), # total: # object_cache: # site_optimization: 'is_accelerate_wp_flag_enabled': is_feature_flag, 'is_accelerate_wp_icon_enabled': is_feature_icon_enabled, 'accelerate_wp_suite_enabled_premium_suite_visible': awp_enabled_visible_premium, 'accelerate_wp_suite_enabled_premium_suite_disallowed': awp_enabled_disallowed_premium, 'features_visible_by_default': sorted(list(server_wide_options.visible_features)), 'features_allowed_by_default': sorted(list(server_wide_options.allowed_features)), 'upgrade_urls': { PremiumSuite.name: server_wide_options.upgrade_url, CDNSuitePro.name: server_wide_options.upgrade_url_cdn }, 'is_smart_advice_notifications_enabled': disabled_status.get(server_wide_options.disable_smart_advice_notifications), 'is_smart_advice_plugin_installation_enabled': disabled_status.get(server_wide_options.disable_smart_advice_wordpress_plugin), 'is_smart_advice_reminders_enabled': disabled_status.get(server_wide_options.disable_smart_advice_reminders), 'is_object_cache_banners_enabled': disabled_status.get(server_wide_options.disable_object_cache_banners), 'whmcs': _read_whmcs_statistics(), } result['allowed_users']['total'] = _get_wpos_statistics_total_count( ALL_OPTIMIZATION_FEATURES, 'allowed', allowed_by_modules=True) result['enabled_sites']['total'] = _get_wpos_statistics_total_count( ALL_OPTIMIZATION_FEATURES, 'enabled', allowed_by_modules=True) result['visible_users']['total'] = _get_wpos_statistics_total_count( ALL_OPTIMIZATION_FEATURES, 'visible') for module in ALL_OPTIMIZATION_FEATURES: # rename it for more obvious stats if module == 'cdn': stats_suite = 'cdn_free' else: stats_suite = module result['allowed_users'][stats_suite] = _get_wpos_statistics_total_count( [module], 'allowed', allowed_by_modules=True) result['enabled_sites'][stats_suite] = _get_wpos_statistics_total_count( [module], 'enabled', allowed_by_modules=True) result['visible_users'][stats_suite] = _get_wpos_statistics_total_count( [module], 'visible') result['enabled_users'][stats_suite] = _get_wpos_statistics_total_count( [module], 'enabled', allowed_by_modules=True, per_user=True) # additional counters for cdn_pro (aka 50gb) result['allowed_users']['cdn_pro'] = _get_wpos_statistics_total_count( ['cdn'], 'allowed', allowed_by_suites=[CDNSuitePro.name]) result['enabled_sites']['cdn_pro'] = _get_wpos_statistics_total_count( ['cdn'], 'enabled', allowed_by_suites=[CDNSuitePro.name], allowed_by_modules=True) result['visible_users']['cdn_pro'] = _get_wpos_statistics_total_count( ['cdn'], 'visible', allowed_by_suites=[CDNSuitePro.name]) result['enabled_users']['cdn_pro'] = _get_wpos_statistics_total_count( ['cdn'], 'enabled', allowed_by_suites=[CDNSuitePro.name], allowed_by_modules=True, per_user=True) for suite in ALL_SUITES: # rename it for more obvious stats if suite == 'accelerate_wp_cdn': stats_suite = 'accelerate_wp_cdn_free' else: stats_suite = suite # additional counter how many users allowed to cdn_pro (aka 50gb) result['allowed_suites'][stats_suite] = \ _get_wpos_statistics_total_count([], 'allowed', allowed_by_suites=[suite]) result['enabled_suites'][stats_suite] = \ _get_wpos_statistics_active_count(suite) if suite == PremiumSuite.name: # fill additional billable / non-billable counters: # object_cache is free, image optimization, critical css is billable result['enabled_suites'][f'{stats_suite}_billable'] = \ _get_wpos_statistics_active_count(suite, features_by_license='billable') result['enabled_suites'][f'{stats_suite}_non_billable'] =\ _get_wpos_statistics_active_count(suite, features_by_license='non_billable') # cdn_free exclusive of cdn_pro _mutually_exclusive_wpos_statistics( result, ['enabled_suites', 'enabled_sites', 'enabled_users'], 'cdn_free', 'cdn_pro' ) return result def _mutually_exclusive_wpos_statistics(wpos_statistics: dict, statistic_keys: list, from_stat: str, subtract_stat: str): """ Returns mutually exclusive statistics """ from_stat_awp = f'accelerate_wp_{from_stat}' subtract_awp = f'accelerate_wp_{subtract_stat}' for key, stat in wpos_statistics.items(): if key in statistic_keys and type(stat) is dict: if from_stat in stat and subtract_stat in stat: stat[from_stat] -= stat[subtract_stat] if from_stat_awp in stat and subtract_awp in stat: stat[from_stat_awp] -= stat[subtract_awp]