forked from ymcatwincities/openy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopeny.post_update.php
24 lines (22 loc) · 982 Bytes
/
openy.post_update.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
* @file
* Post update functions for OpenY Distribution.
*/
/**
* Cleanup upgrade path message errors that we cannot prevent from being created.
*/
function openy_post_update_cleanup_update_path_messages() {
// Here we clean up messages that appeared in the message log during last 5 minutes.
// These messages are generated by node_post_update_configure_status_field_widget() and cannot be handled by upgrade path tool,
// because Drupal Core automatically increases weght which doesn't match database.
// @see node_post_update_configure_status_field_widget()
$range = strtotime("-5 minutes");
$query = \Drupal::entityQuery('logger_entity')
->condition('name', 'core.entity_form_display.node', 'STARTS_WITH')
->condition('created', $range, '>');
$ids = $query->execute();
$storage_handler = \Drupal::entityTypeManager()->getStorage('logger_entity');
$entities = $storage_handler->loadMultiple($ids);
$storage_handler->delete($entities);
}