Discard adding if rabbit hole setting is active

Created on 11 October 2019, about 5 years ago
Updated 22 March 2023, over 1 year ago

It would be nice if you can add a setting if the page is hidden per rabbit hole module, that the node not get added to the sitemap

โœจ Feature request
Status

Needs review

Version

4.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany tobias mรคrz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ท๐Ÿ‡บRussia walkingdexter

    @gbyte I agree with #16. Meta information is stored in the database, most likely the proposed change will create memory issues.

    This hook working during generation but not during queue creation might be confusing for implementers ("Why do only some entities go through this hook?"). This could be circumvented by removing the following from EntityUrlGenerator::getDataSets thus delegating access checks completely to the generation process

    Not sure about this change because I don't fully know the queue processing logic.

    But yeah, this sounds cleaner indeed. I'm not a big fan of hooks either hence this module's extensive API. Just wondering how much code overhead it will be to implement reacting to that event for e.g. the rabbit_hole module as opposed to a hook implementation.

    And I'm not a big fan of mixing hooks and events :) I think we should choose one of these approaches for the whole API.

    ...take a look at the code and state your opinion about all of it

    Is it a good idea to remove the subscriber definition when the rabbit_hole module is not installed? Maybe it's better to add the definition when the module is installed?

  • Assigned to walkingdexter
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany gbyte Berlin

    @gbyte I agree with #16. Meta information is stored in the database, most likely the proposed change will create memory issues.

    I believe right now it is only stored temporarily in \Drupal\simple_sitemap\Queue\QueueWorker::stashResults() along with the rest of the link data when the generation process does not complete during given time. You raise a valid concern however - we should remove all data that is not relevant for generation before it is being passed to the queue worker. I'll make a note. Let me know if you think meta information is stored in the database anywhere else.

    And I'm not a big fan of mixing hooks and events :) I think we should choose one of these approaches for the whole API.

    This is a fair point and seeing the big code overhead events create, I am reluctant to switch to it. Which one do you prefer for this module?

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany gbyte Berlin
  • Issue was unassigned.
  • ๐Ÿ‡ท๐Ÿ‡บRussia walkingdexter

    I believe right now it is only stored temporarily in \Drupal\simple_sitemap\Queue\QueueWorker::stashResults() along with the rest of the link data when the generation process does not complete during given time... Let me know if you think meta information is stored in the database anywhere else.

    My concerns relate specifically to this method. \Drupal\simple_sitemap\Queue\QueueWorker::stashResults() uses the state system to store information. Default implementation of \Drupal\Core\State\StateInterface uses the key/value store. Default implementation of \Drupal\Core\KeyValueStore\KeyValueStoreInterface uses the database to store key/value data.

    \Drupal\Core\State\State - default state implementation.
    \Drupal\Core\KeyValueStore\DatabaseStorage - default key/value store implementation.

    One way or another, in some cases the data is stored in the database during the sitemap generation. Storing heavy data (entity objects) should be justified and at least properly tested. At this moment, I think it more reasonable to store the entity ID and load the object on demand. Note that the entity static cache prevents the same entities from being reloaded in the same request.

    This is a fair point and seeing the big code overhead events create, I am reluctant to switch to it. Which one do you prefer for this module?

    Usually I prefer to use events because they are more flexible. If we want to use events, then we should introduce them in the next major update, since we cannot simply remove hooks due to backwards compatibility.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium dieterholvoet Brussels

    How about we create a new event and dispatch it, + we create a new hook which is invoked in an event subscriber. We immediately deprecate the hook and event subscriber to be removed in the next major release. That way, in the next major release, all that needs to be done is to remove the event subscriber and hook documentation. That also gives us more time to transition the other hooks into events.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany gbyte Berlin

    My concerns relate specifically to this method. \Drupal\simple_sitemap\Queue\QueueWorker::stashResults() uses the state system to store information. Default implementation of \Drupal\Core\State\StateInterface uses the key/value store. Default implementation of \Drupal\Core\KeyValueStore\KeyValueStoreInterface uses the database to store key/value data.

    \Drupal\Core\State\State - default state implementation.
    \Drupal\Core\KeyValueStore\DatabaseStorage - default key/value store implementation.

    One way or another, in some cases the data is stored in the database during the sitemap generation. Storing heavy data (entity objects) should be justified and at least properly tested. At this moment, I think it more reasonable to store the entity ID and load the object on demand. Note that the entity static cache prevents the same entities from being reloaded in the same request.

    I don't intend to be storing objects in the database; you seem to have missed this:

    You raise a valid concern however - we should remove all data that is not relevant for generation before it is being passed to the queue worker. I'll make a note. Let me know if you think meta information is stored in the database anywhere else.

    There is a ticket attached to this issue to make sure nothing like this happens: ๐Ÿ“Œ Check what data is being saved to database upon generation Active .

    How about we create a new event and dispatch it, + we create a new hook which is invoked in an event subscriber. We immediately deprecate the hook and event subscriber to be removed in the next major release. That way, in the next major release, all that needs to be done is to remove the event subscriber and hook documentation. That also gives us more time to transition the other hooks into events.

    Feel free to create a ticket to tackle this in the future. ๐Ÿ“Œ Shift entity access checks from queue to generation Active and passing entities to hooks seems like the simple non-breaking solution in the meantime. I'll take a look at this soon.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    32 pass
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium dieterholvoet Brussels

    I updated the MR to make it compatible with Rabbit Hole 2, dropping support for Rabbit Hole 1.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    32 pass
  • Status changed to RTBC 10 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium stijnstroobants Leuven

    Reviewed and confirmed the patch is working as needed!

  • First commit to issue fork.
  • ๐Ÿ‡ฏ๐Ÿ‡ดJordan mohammad-fayoumi Amman

    Reroll the MR !16 by creating a static patch file to work with the latest stable version 4.2.1

  • ๐Ÿ‡ท๐Ÿ‡บRussia walkingdexter

    My current thoughts:

    • In this issue we should focus on adding the ability to act on a processed entity. I propose to move the event subscriber (or hook implementation) to the Rabbit Hole module by creating a separate issue. Otherwise, I don't think it's right to drop support for Rabbit Hole 1. It's stable, and we'll have to support both versions.
    • The discussion about events and hooks is relevant again because of this change record โ†’ .
    • The proposed code must use all possible type declarations.
    • All warnings from the CI pipeline must be fixed.
Production build 0.71.5 2024