Helper method: Passes a query to the alteration system again.
This allows Entity Reference to add a tag to an existing query so it can ask access control mechanisms to alter it again.
protected function reAlterQuery(AlterableInterface $query, $tag, $base_table) {
// Save the old tags and metadata.
// For some reason, those are public.
$old_tags = $query->alterTags;
$old_metadata = $query->alterMetaData;
$query->alterTags = array(
$tag => TRUE,
);
$query->alterMetaData['base_table'] = $base_table;
drupal_alter(array(
'query',
'query_' . $tag,
), $query);
// Restore the tags and metadata.
$query->alterTags = $old_tags;
$query->alterMetaData = $old_metadata;
}