Problem/Motivation
\Drupal\content_lock\ContentLock\ContentLock::releaseAllUserLocks() is inconsistent with \Drupal\content_lock\ContentLock\ContentLock::release() as it does not trigger the release lock event for each lock it deletes.
Steps to reproduce
Proposed resolution
Add a method to release a collection of locks consistently and use it in this method and in the content lock timeout cron and anywhere else we find.
Remaining tasks
User interface changes
None
API changes
New API method \Drupal\content_lock\ContentLock\ContentLock::releaseExpiredLocks()
\Drupal\content_lock\Event\ContentLockReleaseEvent changes to support multiple entities - any code listening to this event will need to change.
Data model changes
None
Issue fork content_lock-3530760
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
alexpottI'm think that \Drupal\content_lock\Event\ContentLockReleaseEvent should support multiple locks then we only need to trigger a single event. To me this is much better than triggering an event per entity. Or we could remove the event. and replace it will a break lock event that is triggered when your lock is broken not released as that is the only situation where I think an event is potentially useful... ie. send a message to a user that your lock has been broken by a user. Hmmm... maybe you could say the same for releasing... so yeah lets not remove the event. Let's make it support multiple locks...
Also I wonder about the use case of this event firing on entity delete. Like if the entity has been deleted what does anyone care about the lock being released - the entity no longer exists!
Comment #4
alexpottComment #5
alexpottComment #6
alexpottComment #7
alexpottComment #8
alexpottDecided to merge this as it improves releasing locks without entity loads.
Comment #10
alexpott