| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/l.v.e-manager/utils/ |
Upload File : |
# 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
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import sys
from dynamicui_base import DynamicUIBase
sys.path.append(os.path.dirname(__file__))
from lvemanager.config_parser import SectionlessConfigParser
from clcommon.ui_config import UIConfig
class DynamicUIDA(DynamicUIBase):
da_plugin_conf_file = '/usr/local/directadmin/plugins/{}/plugin.conf'.format
def sync(self, plugin):
if plugin == 'all':
self.sync_nodejs()
self.sync_python()
self.sync_resource_usage()
self.sync_xray()
self.sync_awp()
elif plugin == 'nodejs':
self.sync_nodejs()
elif plugin == 'python':
self.sync_python()
elif plugin == 'resource_usage':
self.sync_resource_usage()
elif plugin == 'xray':
self.sync_xray()
elif plugin == 'awp':
self.sync_awp()
def sync_nodejs(self):
from clselect.clselectnodejs.node_manager import NodeManager
self.set_plugin_active('nodejs_selector', NodeManager().selector_enabled)
def sync_python(self):
from clselect.clselectpython.python_manager import PythonManager
self.set_plugin_active('python_selector', PythonManager().selector_enabled)
def sync_resource_usage(self):
try:
self.set_plugin_active('resource_usage',
UIConfig().get_param('hideLVEUserStat', 'uiSettings') is False)
except IOError:
return None
def sync_xray(self):
try:
self.set_plugin_active('xray', UIConfig().get_param('hideXrayApp', 'uiSettings') is False)
except IOError:
return None
def sync_awp(self):
try:
self.set_plugin_active('awp', UIConfig().get_param('hideAccelerateWPApp', 'uiSettings') is False)
except IOError:
return None
def set_plugin_active(self, plugin_name, state):
config = SectionlessConfigParser()
config_file = self.da_plugin_conf_file(plugin_name)
config.read(config_file)
config.set('__config__', 'active', 'yes' if state else 'no')
with open(config_file, 'w') as f:
config.write(f)