<?php require 'vendor/autoload.php'; $platforms = new \Controller\PlatformController(); $platforms = $platforms->fetchAllPlatformsWithColumn("name"); //Counter for number of processes $i = 1; foreach ($platforms as $platform) { $pid = pcntl_fork(); if (!$pid) { echo 'starting child ', $i, PHP_EOL; $controllerInstance = new \Controller\StatusController($platform->name); file_put_contents("/var/www/html/demo/seethru/{$platform->name}.json", json_encode($controllerInstance->getStatus())); exit; } $i++; }
if ($ops_admin_email) { $fieldsToUpdate['ops_admin_email'] = $ops_admin_email; } if ($gen_admin_email) { $fieldsToUpdate['gen_admin_email'] = $gen_admin_email; } if ($ipAddress) { $fieldsToUpdate['ip_address'] = $ipAddress; } $platformController->updatePlatform($fieldsToUpdate, intval($id)); file_put_contents('platforms.json', json_encode($platformController->fetchAllPlatforms())); echo json_encode(array('message' => "Platform has been updated successfully..")); }); $app->delete("/platform/:id", function ($id) use($app, $platformController) { $platformController->removePlatform(intval($id)); file_put_contents('platforms.json', json_encode($platformController->fetchAllPlatforms())); echo json_encode(array('message' => "Platform has been deleted successfully..")); }); /////////////////////////////////////////////////////////////////////////////////////////////////////// //STATUSES /////////////////////////////////////////////////////////////////////////////////////////////////////// $app->get("/status/:platform/:module", function ($platformName, $moduleId) use($app) { $statusController = new \Controller\StatusController($platformName, 8585, $moduleId); echo json_encode($statusController->getStatus()); }); $app->get("/uptime/:platform", function ($platform) use($app) { $status = \Controller\StatusController::getSevassAppStatus($platform); echo json_encode($status); }); }); $app->run();