protected function SyncHealth::filterSyncCoreLogMessages in CMS Content Sync 2.0.x
Same name and namespace in other branches
- 8 modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::filterSyncCoreLogMessages()
- 2.1.x modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::filterSyncCoreLogMessages()
Filter the given messages to only display those related to this site.
Parameters
array[] $messages:
Return value
array[]
1 call to SyncHealth::filterSyncCoreLogMessages()
- SyncHealth::overview in modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php - Render the overview page.
File
- modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php, line 220
Class
- SyncHealth
- Provides a listing of Flow.
Namespace
Drupal\cms_content_sync_health\ControllerCode
protected function filterSyncCoreLogMessages($messages) {
$result = [];
$allowed_prefixes = [];
foreach (Pool::getAll() as $pool) {
$allowed_prefixes[] = 'drupal-' . $pool
->id() . '-' . DrupalApplication::get()
->getSiteMachineName() . '-';
}
foreach ($messages as $msg) {
if (!isset($msg['connection_id'])) {
continue;
}
$keep = FALSE;
foreach ($allowed_prefixes as $allowed) {
if (substr($msg['connection_id'], 0, strlen($allowed)) == $allowed) {
$keep = TRUE;
break;
}
}
if ($keep) {
$result[] = $msg;
}
}
return array_slice($result, -20);
}