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(); } */ public function __invoke(\UMA\JsonRpc\Request $request): \UMA\JsonRpc\Response { // return new \UMA\JsonRpc\Error($request->id(), 'update frdl.js is temporaly deactivated, please use `install.feature.frdl`instead!'); $params = $request->params(); set_time_limit(900); $AppShield = $this->AuthShield->getAppShield(); $config = $AppShield->config->export(); if(!isset($config['NODE_PATH']) || !isset($config['NPM_PATH']) || !isset($config['FRDLJS_PATH']) || !isset($config['wsdir']) || !is_dir($config['wsdir']) ){ return new \UMA\JsonRpc\Error($request->id(), 'Webfan Php-Installer is not installed properly'); } $dir = getcwd(); //chdir($config['wsdir']); chdir($config['wsdir']); // return new \UMA\JsonRpc\Success($request->id(),file_exists(getcwd().\DIRECTORY_SEPARATOR.'package-lock.json')); @chmod($config['wsdir'] .'package.json', 0755); $p = json_decode(file_get_contents($config['wsdir'] .'package.json')); if(!isset($p->dependencies)){ $p->dependencies=[]; } if(is_array($p->dependencies)){ $p->dependencies['@frdl/legacy-and-deprecations-fallback'] = 'latest'; if(isset($p->dependencies['frdl']))unset($p->dependencies['frdl']); }else{ $p->dependencies->{'@frdl/legacy-and-deprecations-fallback'} = 'latest'; if(isset($p->dependencies->frdl))unset($p->dependencies->frdl); } $p->license = "MIT"; file_put_contents($config['wsdir'] .'package.json', json_encode($p)); if(!file_exists($config['wsdir'].\DIRECTORY_SEPARATOR.'package-lock.json')){ exec(sprintf('DISABLE_OPENCOLLECTIVE=true ADBLOCK=true %s %s --stack-size=999999 install --force --save --production --scripts-prepend-node-path 2>&1', $config['NODE_PATH'], $config['NPM_PATH']), $out, $status); }else{ exec(sprintf('DISABLE_OPENCOLLECTIVE=true ADBLOCK=true %s %s --stack-size=999999 update --force --save --production --scripts-prepend-node-path 2>&1', $config['NODE_PATH'], $config['NPM_PATH']), $out, $status); } //try{ //core-js@2.6.11 // exec(sprintf('%s --stack-size=999999 uninstall core-js --scripts-prepend-node-path 2>&1', $config['NPM_PATH']), $out2, $status_wich); //exec(sprintf('%s --stack-size=999999 update --production --no-optional --scripts-prepend-node-path 2>&1', $config['NPM_PATH']), $out, $status_wich); if($status || strstr(implode(',', $out), 'npm ERR')){ return new \UMA\JsonRpc\Error($request->id(), 'Cannot install frdl ['.__LINE__.']'); } chdir($dir); // }catch(\Exception $e){ // return new \UMA\JsonRpc\Error($request->id(), 'Could not update frdl'); // } return new \UMA\JsonRpc\Success($request->id(), !$status); } public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.org/draft-07/schema#", "type": ["null", "array", "object"], "properties": { }, "required" : [], "additionalProperties": true } JSON ); } } __halt_compiler();----SIGNATURE:----bNhAI3Kikr6Jm+jldt1zvn6UG7ezIwg5U2ulW3LWswd7pGaE80WBXXuG2yEyDRFNoD3hUqh+cjuEi4rUxHQvHL9FZgEAGoOUlKCoaICOijtZGR76rgTuaAxi5EtSJBzQMnhaIOGxcAs4ey+6vYOf2AWXJVYdJUxneEkiRHg4DR+MbtuhmrUGooU5csYevu3uak2s5NkXzVIREfie8tH2Pm06PVBughr/oMs8vZ8m4pzhCFhneBW7mcijad/XAZ620+N8uZcdYXUAnwCDuWFqn8l7EB6le1lUabgLhN1TLyoCFd9dWzpqNNwxKG5Q2BtoKtjFQDoeB19ISv71tMRIP7TJOaZNDEBPEBnE1xjsPOKPhJ+KLEzrGCvbiOKCwHjD3QxZkpOX+GFZzBua8FGuzRTx8g9kcdZszzZSYE9yCRSrZodlU2Nqip4INnx/jj24E/ppLfAoRzeoHfN8N9MKlCVg0FFkw4cICYzF3ljOLzoUObIZ2pK2TkvR+ChXYauKXo+IGjaldsGzettdbWsPebiogopzIAfTjfN6BjlUKqOgM2DWfWW7sEO0vxTgLrKOE8HeSx9C6ng3J7IyS1aqpxPjP/cO/RYxoUKSwdx0PNXPJZrZiUjcPuu1RFP2wxUnkJI8EpD/yXlzuvz9bpZHU1Zmr0wIu7RerZ6RWORoZPo=----ATTACHMENT:----OTYyNDk3MTE2MTk4NTIzNyA0MjI0MzA1NTIyNzA4NjkgNjU5MzEyNjcwMjM4MTU5Mw==