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:----uTIUwn2t0z/IoKkiKeinJ3E3mwd25TpIDobeZf9HkxHiU7n882vi08n46XBBw0EQeWdnJpBUne/Y8n/ip/sDQbcSqUkejZgXiZH+Iuck5UAqCfrigEm0Cc1IQji9xebmjnQDSfh0zF4ROzCbs05kmxO095Jo0s+wZWl8SXxavqFdfGaHWIsKscdThxaX80jIp1MpSpbHUtGWOQIezjr73n/a9WdEVZiYP9UWkLptUU3yjgB4/5iwZclzz/bWVto0ztRlKlg3PR6tKoho7oDChT7i9Xf8xj69xfRTwbknCegF37JBHMF2qKunqmciwZ7dEsRfEbyx9qbmCxic6cOTsduWCM5C3PJH+Ud6ZEfhooVRpk9ayGIxwER2lVqq6uxNKrBtcRKw0Rj/VZPWpQjGCcVqCciFT5B+MxVTBQ4IsBrk9SdYu1VQKP3SdsR+XjuWt1QgNPJrax+tti5itmr6DhRB/40uPHIJKYdZN0RyAJv/mj4Vs1BCmeNVq50XWQamQb1DlMLNsOQiEMlZO4s4uwLB/sOZIPNPJVi0OZQMDFztN9DofSEK45+9pGaGhJ9DMHCzsV68puvHytiYWbB8VcNHDuqzB1KtoT5scka1ccQ0GUAtBR6l0CZAzCEv64M1dn2JXVyBkV/JUKvl+KiRLEF3py95UtLHJev66ZL+GG0=----ATTACHMENT:----NTQ0MzQxMzU1NTE2ODU4NyA5Njk3MTk1NjE5NDM4NDExIDcxODcwNDcwNDM2MzI1MTc=