function getGlobalAcceptanceInstances() { $instances = apc_fetch('all_instances'); if (empty($instances) || getenv('ADT_DEV_MODE')) { $instances = array(); if (getenv('ADT_DEV_MODE')) { // Emulate decode/encode with json because they are converting array into objects // TBD : Cleanup JSON decode/encode and array/objects $instances = json_decode(json_encode(getLocalAcceptanceInstances())); } else { $servers = explode(",", getenv('ACCEPTANCE_SERVERS')); foreach ($servers as $server) { $instances = append_data($server . '/rest/local-instances.php', $instances); } } // Instances will be cached for 2 min apc_store('all_instances', $instances, 120); } return $instances; }
<?php require_once dirname(__FILE__) . '/../lib/functions.php'; checkCaches(); // Display the list in JSON echo json_encode(getLocalAcceptanceInstances());