function __construct($route = "") { $this->mod("tool"); // charge tool pour la fonction merge_unique(); $autoloadKernel = json_decode(file_get_contents(DIR_AUTOLOAD), true); if ($route != "") { $autoloadRoute = $this->getAppAutoload($route); $autoloadComplete = merge_unique($autoloadKernel, $autoloadRoute); } else { $autoloadComplete = $autoloadKernel; } /* End fusion de l'autoload de l'App */ $this->config = $autoloadComplete; $this->getMod(); $this->getLibPhpInit(); }
$error = array(); /******/ $appAutoload = new appAutoload(); $appAutoload->mod("file"); $list = file::folder_list(DIR_APP); $compile = []; $serviceInitFile = "services.json"; foreach ($list as $key => $value) { $info = pathinfo($value); $app = $info["filename"]; // createService($app); /* service */ /* LOG compile service */ $c->log("compile service", __FILE__, $app); /* END LOG compile service */ $compile = merge_unique($compile, createService($app)); } $jsonConfigEncode = json_encode($compile, JSON_PRETTY_PRINT); $c->saveServices(); file_put_contents(DIR_SERVICES, $jsonConfigEncode); function createService($app) { /* PAGE */ $newServiceDir = DIR_APP . "/" . $app . "/config"; if (!file_exists($newServiceDir)) { mkdir($newServiceDir); } $service = $newServiceDir . "/services.json"; $serviceContent = '{}'; // file_put_contents($service,$serviceContent); $json = json_decode(file_get_contents($service), true);
$error = array(); $appAutoload = new appAutoload(); /**** MON EXEC ****/ $appAutoload->mod("file"); $list = file::folder_list(DIR_APP); /* Tableau a compiler*/ $compile = []; $app = []; /* Fichier route */ $routingInitFile = "routing.json"; /* Parcours de la liste d 'app installer */ foreach ($list as $key => $value) { $info = pathinfo($value); $app = $info["filename"]; /* Routing */ $compile = merge_unique($compile, getRouting($app)); } $app = $compile; $jsonConfigEncode = json_encode($compile, JSON_PRETTY_PRINT); $c->saveRouting(); file_put_contents(DIR_ROUTING, $jsonConfigEncode); function getRouting($app) { $configDir = DIR_APP . "/" . $app . "/config"; $routingFile = $configDir . "/routing.json"; return $json = json_decode(file_get_contents($routingFile), true); } /**** END MON EXEC ****/ $valid = count($error) == 0 ? true : false; //la condition /* Return for json content */