prepareAndExecute( 'SELECT * FROM parcels INNER JOIN ' . SEARCH_REGION_TABLE . ' AS r ON parcels.regionUUID = r.regionUUID', ); $registered_parcels = $query->fetchAll(PDO::FETCH_ASSOC); $grids_info = osdb_cache_get( 'grids_info', array() ); // Calculate stats per gatekeeperURL $stats = []; foreach ($registered_parcels as $host) { $gatekeeperURL = $host['gatekeeperURL']; $grids_info[$gatekeeperURL] = $grids_info[$gatekeeperURL] ?? OpenSim_Grid::get_grid_info($gatekeeperURL); if (!isset($stats[$gatekeeperURL])) { $stats[$gatekeeperURL] = [ 'regions' => [], 'parcels' => 0, ]; } $stats[$gatekeeperURL]['parcels']++; $region = $host['regionUUID']; $stats[$gatekeeperURL]['regions'][$region] = true; } osdb_cache_set( 'grids_info', $grids_info, 86400 ); $grid_count = count($stats); $allregionscount = 0; $allparcelscount = 0; foreach ($stats as $gatekeeperURL => $data) { $regionCount = count($data['regions']); $allregionscount += $regionCount; $parcelCount = $data['parcels']; $allparcelscount += $parcelCount; $gridname = $grids_info[$gatekeeperURL]['gridname'] ?? $gatekeeperURL; $stats_display .= sprintf( '%s (%d regions, %d parcels) ', $gatekeeperURL, $gridname, $regionCount, $parcelCount ); // "$gatekeeperURL ($regionCount regions, $parcelCount parcels) "; } $content = sprintf( '%d grids, %d regions, %d parcels ', $grid_count, $allregionscount, $allparcelscount ); $content .= $stats_display; // $content .= "
Grid info cache:
" . print_r($grids_info, true) . ""; if(! empty($debug)) { $content .= '
Debug data:
' . print_r( $debug, true ) . '