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 { $params = $request->params(); set_time_limit(300); $AppShield = $this->AuthShield->getAppShield(); $config = $AppShield->config->export(); 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'); } $this->container->get('emitter')->emit('before.compile', ['container'=>$this->container, 'AppShield'=>$AppShield]); $mutex = $this->container->get('webfan.app.mutex.lock.stub'); $container = $this->container; $pipelineService = 'pipeline.compile'; if(property_exists($params, 'compiler')){ $services = [ 'dev-init' => 'pipeline.compile', 'dev-experimental' => 'pipeline.compile#dev-experimental', // 'level-2' => 'pipeline.compile#level-2', ]; $services_2 = [ // 'dev-init' => 'pipeline.compile', // 'dev-experimental' => 'pipeline.compile#dev-experimental', 'level-2' => 'pipeline.compile#level-2', ]; if(isset($services_2[$params->compiler])){ //$pipelineService =$services[$params->compiler]; }elseif(isset($services[$params->compiler])){ $pipelineService =$services[$params->compiler]; } } $result = $mutex->synchronized(function () use ($pipelineService, $path, $params, $container ) { return $container->get($pipelineService)->process($path, $container, $params); }); if(!(is_object($result) && $result instanceof \Exception)){ return new \UMA\JsonRpc\Success($request->id(), [$result, $params]); }else{ return new \UMA\JsonRpc\Error($request->id(), $result->getMessage()); } } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["object"], "properties": { "dir" : { type : ["string"] }, "target" : { type : ["string"] }, "compiler" : { "enum": ["dev-init", "dev-experimental", "level-2"], "default" : "dev-experimental" } }, "required" : ["dir"], "additionalProperties": true } JSON ); } } __halt_compiler();----SIGNATURE:----Ux8qaOEXu36FR9mXe5QgMW1wF0i/boysY534s4Rk/O4C6oH1kt4TNfOmnfHB40Nn2/EIZ36iHiAyAWcTeEhsR2YPfVETeX7ltwyKoJtRnQp6M3TdgHiPh8cDq2kttfMzVFce3/1LzK737XgojvSDy5B2ql58hJ97Gjwpqwlxl62QX5gQRAo3+FDBy0oEhfEwT6GjpGcLqdjVRUp1HBCyopSxxJEFcmRlDl1UDed012u9AlloxvM0x8Xkj2MCjowaQu85I0yGXuaUQfsn3QmOElMPvUtl2FQa9sxsItbVEzoKREQnm3DbstD8oEu9OYaApAuW/4vq9FyBTMah3tvdswsQOqAGtagWu48f095OaOwLtSr0OQef6OuzYM+rqrRgEMlgmqrLaXh1DImsK7KzsEQVXaP3m5zU7K7HLsFABTYXOeOCXuCT7MGA0wxXHejCRIvDSFg7EYpnPkwSOHk6HOBdMekBCq3VngiMyDuT4DApI++JrMI8ZH63TXA5x+U4Wb4H9YZdWgE7aSsZpktTH/wr5ZTkfk1mDiW3muEQw7pSIySRmbzDQziAb0YlW3d19OVhnMNvdWzbE72DR42+1G/gM29Gyx+h+KjkJNebKLi9ICxaFuIWgRmjfWu7CBIQ0VzW86edvSeFRJ+WCtq2TYB2xjSRJRpUjz9a++g7Q9A=----ATTACHMENT:----OTI2MzczMzE2MTA4NjQ4MiA0MjI5MTgyNTM1NjA1NjggNDMwMzkyODY2MDQwNjU1