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:----HmKa1SutXvQE8S228sQERV9WOEfaFFGVLrfqegnXzjmR0l9ntuLhVwjoldB2h6xvxTahBu3ZXzTiIlOLYzmPun67YfuLgREjVzafODVc1nyewvXwHGLAwz4SOlDOZonTGfmFRRIzmqcVRGyMIZp9pABsmrE+GCgCftiRDDUSg5lqjWvRhhLkrpPWJilQzQJl8meA2QoxwTQJ4I3FDyDuyH3i/NswgI1Koc0FSqhsgag/tBihPpE5GS90oijQyJAg/4adomwskmOEIPvYi5KW7qtH1oVcYevAD5Isc/CXyQb4e0H4czll2xQtYrhg/FO3QOS/S8Mu0M6ydw7Yg4CnKWQYBKhzcIKFsuO48rw66QqPlBab61IOZsFBnfloF5cAyG1oE+JeUvLgahrLQ1jnB+2Hfw4haEYLj6V19TQMeV9/TDkkL8Ln8qIY+l0cM8mMvTiedKFzGk0Gpo5xGSKzdvTsYeBFGMBQjAv7YLIMxloXEAWE5pSfxgWrC9qbDxzA7hkIbPHwPowUYJq/BkiYNssy8losdQsK6roO21vnsTWVPGKmycREpM63s6BPxqEAxqHLV1DDh71sTMXopKQtDpuca6yKDNKA/N/O8NugR30KMAHl4tsRpB1x46HYN3Qrs8sBMZcj1ewlurei1TXBJHEGxyCV2aWpFqIo3HE3zSI=----ATTACHMENT:----NjI2NDMxOTMwMjA1NDUwOCA2MjcxODMzMzg0NDg3MjU0IDY3OTk5NDQ1MzExNTc2OQ==