RddlZddlZddlZddlmcmZddlmZddl m Z ddl m Z ddl mZmZmZmZmZmZmZddlmZddlmZmZddlmZdd lmZmZdd lm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&m'Z'm(Z(dd l)m*Z*dd l+m,Z,m-Z-m.Z.m/Z/dZ0hdZ1eZ2dZ3dZ4e0fdZ5d3dZ6d4dZ7dZ8dZ9dZ:dZ;dZ< d5dZ=dZ>d Z?d!Z@d"ZAd#ZBeBd4d$ZCd6d%ZDd4d&ZEd7d'ZFd8d(ZGd)ZHd*ZId+ZJd,ZKd-ZLd.eMd/eNfd0ZOGd1d2e'ZPdS)9N) defaultdictwraps) format_exc)AnyAnyStrDictListOptionalTupleUnion)urlparse)ClPwd mysql_lib)uid_max)"_docroot_under_user_via_custom_binget_domains_via_custom_binary) DuplicateDataNoDomain NoPackage NoPanelUser NotSupported)DomainDescriptionGeneralPanelPluginV1PHPDescription)Feature)ExternalProgramFailedfind_module_param_in_configget_modules_dir_for_alt_php run_commandz/etc/psa/.psa.shadow>dnsmaillocalecploginpackageresellerPleskc@tjdS)N/usr/local/psa/version)ospathisfile/builddir/build/BUILDROOT/alt-python27-cllib-3.4.36-1.el9.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/plugins/plesk.pydetectr0s 7>>2 3 33r.ci}d|d<t|dd5}||d<dddn #1swxYwY|S)Nadminloginrutf-8encodingpass)openreadstrip) _pass_pathaccessfs r/ db_accessr?#s FF7O j# 0 0 0*A))v*************** Ms*AAApsaFc .|p t}|dd}|d}|d}tj||||dd|} | 5} | ||cd d d S#1swxYwYd S) a Return the result of a Plesk database query :param query: SQL query string with possible parameters :param data: arguments for the SQL parameter insertion :param _access: database authentication data :param _dbname: the name of the database :param as_dict: controls the format of the output data :type query: str :type _access: dict :type as_dict: bool :return: Tuple of rows according to the query in the format specified by as_dict :rtype: tuple(tuple) or tuple(dict) host localhostr3r8Tutf8)rBuserpasswddb use_unicodecharsetas_dict)argsN)r?getrMySQLConnectorconnect execute_query) querydata_access_dbnamerJr=dbhostdblogindbpass connectorrGs r/ query_sqlrX+s0 # F ZZ , ,FWoG F^F(f76,3v18:::I     2D11222222222222222222s&B  BBc:dtdD}|S)Ncg|] }|d Srr-).0 fetched_ones r/ zcpusers..OsQQQk;q>QQQr.)r$)keylscpinfo)rRrS cpusers_lsts r/cpusersrcNs&QQV-5P5P5PQQQK r.c8d}dt|DS)Nz?SELECT clients.login FROM clients WHERE clients.type='reseller'cg|]\}|Sr-r-r\r$s r/r^zresellers..Us 6 6 6 G 6 6 6r.rXsqls r/ resellersrjSs! KC 6 6y~~ 6 6 66r.cRd}tdt|DS)Nz