AuthShield = $AuthShield; $this->container=(null!==$container) ? $container : $AuthShield->getAppShield()->getContainer(); } public function auth(\UMA\JsonRpc\Request $request){ return 'admin' === $this->container->get('webfan.app.fsm.user')->getCurrentState()->getName(); } /** * {@inheritdoc} */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { $dir = getcwd(); $params = $request->params(); $AppShield = $this->AuthShield->getAppShield(); $config = $AppShield->config->export(); set_time_limit(300); if(!isset($config['COMPOSER_PATH'])){ return new \UMA\JsonRpc\Error($request->id(), 'Composer is not setup correctly'); } if(!property_exists($params, 'dir')){ return new \UMA\JsonRpc\Error($request->id(), 'No `dir` specified'); } $path = str_replace('//', '/', $params->dir); $path = str_replace('/', \DIRECTORY_SEPARATOR, $path); $path = str_replace('composer.json', '', $path); $original_path=$path; if(!is_dir($path)){ $path = $config['wsdir'] . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . \DIRECTORY_SEPARATOR . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . 'frdl-projects' . $original_path; } if(!is_dir($path)){ $path = $config['wsdir'] . 'frdl-projects' . \DIRECTORY_SEPARATOR . $original_path; } if(!is_dir($path)){ return new \UMA\JsonRpc\Error($request->id(), '`dir` does not exist'); } chdir($path); /**/ $j = 'vendor'.\DIRECTORY_SEPARATOR.'composer'.\DIRECTORY_SEPARATOR.'installed.json'; if(file_exists($j)){ unlink($j); } exec(sprintf('%s clearcache 2>&1 ', $config['COMPOSER_PATH']), $out, $status); $cl = 'composer.lock'; if(file_exists($cl)){ unlink($cl); } if($status){ return new \UMA\JsonRpc\Error($request->id(), implode("\n", $out)); } return new \UMA\JsonRpc\Success($request->id(), implode("\n", $out)); } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "dir" : { type : ["string"] } }, "required" : ["dir"], "additionalProperties": true } JSON ); } } __halt_compiler();----SIGNATURE:----qjO83ksCmventIc9/jXy9yqnw46ebyIP84JnoH/X7+vQr29T007ebMdY7Sab3EUc1I9LW2S2MYZL11picZDCeDpf1sBWv6WFI7AuUT66JhusmwQhNTOtNyahwGEL3Ov792iL6jEShNsItMRM4v4sjnDyLAjkycejx2zQuxpXi5VKEQNF/s6YkJ6qKaOlMNgtRkYqybqZPM2qo7VTCDNCxA/Zxn4b6zsZ8p3GJD2frniv/5WwvfNCsw+iCgaqL8/KYSU3obonwbrVnQpwEh83IzInF2FUdetEY6IFCF0qN2A1lqHeuips05vMfGUsulzMHNLL7nEHoeesyqrYm7Yz2F4qgnsjgFdySi/rqRvxsVFH9dulpCZfJ2x5mlpCuV5i2PvcXQegTmIJJ7kq6gJdP8ZGr3mzTKkq9fhaDRvqPLOxnTyVmK44nTzGrej4ypa0f8y+mrSunuLiq1m9+yjUDMCCGHWnpvbKO6xO1kxEYLOAiOmMdQYVaDoTqcNaU0qTqd5ECJQlJHtDzT6KO32jwySiLBJYbWFOlB3Ut/p+l/36AXY/DCBFMsYapjQDczJJfbVthST413UtN+UQPdJiLGaj0ZJqsit0bKdsfLJ8t8ePKnnahzc1+abQYnXBZrw5rbOXl7uIe3aas+zegzHUlhhJyh6rubGmH1rwSMgFNog=----ATTACHMENT:----NzkyODQ2MTcwMjQzODA5MyAyNjk3NTM0NTE4NTcwNjA5IDY5ODU2OTMzMTg0NTQwODk=