K6h DdZddlZddlZddlmZmZGddZdS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)PIPE check_outputceZdZdZdZdZed dedefdZedZ ed Z ed Z ed Z d S)PleskSdkzPHP wrapper for Plesk SDK)pleskphpz-rzf require_once("sdk.php"); pm_Context::init("revisium-antivirus"); {}; Trreturnc |j|}dt dd|D}|rt jdd|}|S)zW Append a piece of code to the header and make it a single-line string Nc3>K|]}|VdS)N)strip).0lines S/opt/imunify360/venv/lib/python3.11/site-packages/imav/migration_utils/plesk_sdk.py z!PleskSdk._join../s*!M!M4$**,,!M!M!M!M!M!Mz(\W)\s+|\s+(\W)z\1\2)_phpformatr joinfilter splitlinesresub)clsrstrip_whitespacescoders r_joinzPleskSdk._join)st xsyy{{++ GGF4!M!M4??;L;L!M!M!MNN O O  7)7A66Arcrg|j|||R}t|tdS)NT)stderrtext)_cmdrrr)rrargscmds rexecz PleskSdk.exec4s:00#))C..0400C48888rc,|dS)Nzecho pm_Context::getVarDir())r%)rs rcontext__get_var_dirzPleskSdk.context__get_var_dir9sxx6777rcT|d|tj|S)Nz)echo pm_Settings::get($argv[1], $argv[2]))r%jsondumps)rkeydefaults r settings__getzPleskSdk.settings__get=s+xx 7  Jw     rc`d}tj||}|r|niS)Na echo json_encode( array_map( function ($domain) { $props = [ "id" => ["getId", []], "name" => ["getName", []], "document_root" => ["getDocumentRoot", []], "owner" => ["getSysUserLogin", []], "imav_cleanup_allowed" => ["hasPermission", ["ra_cleanup_allowed"]], ]; $result = (object)[]; foreach ($props as $property => [$method, $args]) { try { $result->{$property} = call_user_func_array([$domain, $method], $args); } catch (Throwable $ignored) {} } return $result; }, pm_Domain::getAllDomains() ) ); )r)loadsr%)rrdomainss rdomain__get_all_domainsz PleskSdk.domain__get_all_domainsEs5.*SXXc]]++")wwr)rN)T) __name__ __module__ __qualname____doc__r"r classmethodstrrr%r'r-r1rrrrs## D  D [99[988[8  [ **[***rr)r5r)r subprocessrrrr8rrr:sw* ))))))))F*F*F*F*F*F*F*F*F*F*r