}Ce>ddlmZddlmZddlmZddlmZddlZddlZddlZddlm cm Z ddl m Z ddlmZddlmZdd lmZmZmZmZmZmZmZdd lmZdd lmZmZdd lm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,ddl-m.Z.m/Z/ddl0m1Z1m2Z2m3Z3dZ4hdZ5e(Z6dZ7dZ8e4fdZ9d7dZ:d8dZ;dZdZ?dZ@ d9d"ZAd#ZBd$ZCd%ZDd&ZEd'ZFeFd8d(ZGd:d)ZHd8d*ZId;d+ZJddnsmaillocalecploginpackageresellerPleskc@tjdS)N/usr/local/psa/version)ospathisfile/builddir/build/BUILDROOT/alt-python27-cllib-3.3.7-2.el7.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/cpapi/plugins/plesk.pydetectr3&s 7>>2 3 33r1ct}d|d<t|d5}||d<dddn #1swxYwY|S)Nadminloginrpass)dictopenreadstrip) _pass_pathaccessfs r2 db_accessr@*s VVFF7O j#  *!))v*************** Ms*AA!ApsaFc .|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 localhostr6r8Tutf8)rCuserpasswddb use_unicodecharsetas_dict)argsN)r@getrMySQLConnectorconnect execute_query) querydata_access_dbnamerKr>dbhostdblogindbpass connectorrHs r2 query_sqlrY2s0 # F ZZ , ,FWoG F^F(f76,3v18:::I     2D11222222222222222222s&B  BBc:dtdD}|S)Ncg|] }|d Srr0).0 fetched_ones r2 zcpusers..VsQQQk;q>QQQr1)r')keylscpinfo)rSrT cpusers_lsts r2cpusersrdUs&QQV-5P5P5PQQQK r1c8d}dt|DS)Nz?SELECT clients.login FROM clients WHERE clients.type='reseller'cg|]\}|Sr0r0r]r's r2r_zresellers..\s 6 6 6 G 6 6 6r1rYsqls r2 resellersrkZs! KC 6 6y~~ 6 6 66r1cRd}tdt|DS)Nz