fj*&ddlZddlZddlZddlZddlZddlZddlmZGddZ Gdde Z de iZ dZ d e fd Zd Zd ZdS) N)gettextcNeZdZdZdZdZdZdZdZdZ dZ dZ de de fd Z d ZdS) Pluginz\ Helper class which hides differences of WordPress plugins behind abstract methods. Nc|x}dS|D]}d||vr||dcStjd|jdS)z'Get the plugin version from plugin dataNversionz Can't get the %s plugin version.)_get_data_dictloggingerrorNAME)self plugin_datasections \/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/adviser/wordpress_plugin_manager.py _get_versionzPlugin._get_versionst..00 0K 94" 7 7GK000"7+I66661  949EEEtctj|jfdD}|S)zRead the ini filecVi|]%}|t|&S)dictitems).0s config_objects r z)Plugin._read_ini_file...s1QQQ1$}**1--..QQQr) configparser ConfigParserreadINFO_FILE_PATHsections)r outputrs @r_read_ini_filezPlugin._read_ini_file*sR$133 4.///QQQQ 8N8N8P8PQQQ rc|j\tj|jr|}||_nt jd|jdS|jS)!Get the plugin data from ini fileNzCan't read the %s plugin data.) PLUGIN_DATAospathexistsrr"r r r )r datas rr zPlugin._get_data_dict2sc   #w~~d122 **,,#'   ?KKKtrplugin_versiondest_dirc  |r|stjd|jdStj|}tj|sGtd|}tj|td|Stj d}|4td}tj|td|S tj t|j}nK#tt f$r7td}tj|td|cYSwxYwtj|}||d zsM||krGtd |}tj|td|S|}|Ltd |j}tj|td|S|jd z|z}tj||d z}||kr| tj|} t+j| jrGtd|}tj|td|Std|S#t0$rYnwxYwd} d} tj|tjtjztjz} tjd| } | |d zsz| |krttd| }tj|td|| tj| | tj| SS|d z} tj| tjtj ztj!ztjzd| } t3|j"d5} |#d}|sn3tI|}|r!tj%| |}||d}|!K dddn #1swxYwYtj&| }tj'| |j(|j)n#tT$rYntV$r}td|jtY|}tj|| *| ( tj-| | n#tV$rYnwxYwtd|cYd}~| tj| | tj| SSd}~wwxYw| tj| | tj| n2#| tj| | tj| wwxYwtd|S)z Get plugin info if there is a new version and the update is true copy the plugin archive to the given folder for updating z:Can't get old plugin version or destination folder for %s.Nz(Destination directory does not exist: {}Fr XRAYEXEC_UIDz+XRAYEXEC_UID is not set, refusing operationz-Cannot resolve requesting user home directory/z.Destination directory is outside user home: {}z&Cannot determine plugin version for {}-z.zipz&Plugin path is a symlink, refusing: {}T)packagez/proc/self/fd/{}z0Resolved directory path is outside user home: {}i)dir_fdrbizCError happened while copying WordPress {} plugin archive. Error: {}).r r r r&r'realpathisdir_formatformat_responsegetenvpwdgetpwuidintpw_dirKeyError ValueError startswithrjoinlstatstatS_ISLNKst_modeFileNotFoundErroropenO_RDONLY O_DIRECTORY O_NOFOLLOWreadlinkcloseO_WRONLYO_CREATO_EXCL ZIP_FILE_PATHr memoryviewwritefstatfchownst_uidst_gidFileExistsErrorOSErrorstrunlink)r r*r+r exec_uid caller_home new_versionfilenamedest_plugin_pathstr2fd real_dir_path dest_filenamesrcchunkmvwrittendir_states r copy_pluginzPlugin.copy_plugin>s  X  MWY]Yb c c c47##H--w}}X&& 7@GGQQRRE M% "5666 6 9^,,  CDDE M% "5666 6 7,s8}}55EEdiPPQQE M% "5666 69s?[07<<(V2CDD k ) )* X.//< ++?FMM(**++EM%(((*5>>>>&t5EFFFF$    FBA %K".02=@ !# ,>,E,Ef,M,M N N $// c0ABB?}XcGcGcPWW%''((EM%(((*5>>>^>HRLLL%HV$$$$&Y!)6 1 W!K"*,ry82=H! $,d33.s. #$"!'.. .&(hr2&6&6G!#GHHB!. ." ...............8F++ "hox????"    ; ; ;&&,fTYA&?&?AA e$$$>f&8 -?????"&uE::::::::>HRLLL%HV$$$$& ;>HRLLL%HV$$$>HRLLL%HV$$$$&t-=>>>>s1&DAE E A3L 8L LLCT A#T 3A S  T ST S7T X WX W"A W0VW VWVW'W(XWX/X>cn|js||_td|jS)r$T)r))r%r r8)r s rget_datazPlugin.get_datas7 5#2244D t$*:;;;;r)__name__ __module__ __qualname____doc__r SOURCE_DIRrrPr%rr"r rYrjrlrrrrrs DJNMK       H?#H?H?H?H?H?X<<<<rs  }<}<}<}<}<}<}<}<@.....F...#M2,,,+C++++ Q Q Q     r