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

Command icon 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

alexpott created an issue. See original summary.

alexpott’s picture

I'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!

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
alexpott’s picture

alexpott’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Issue summary: View changes
alexpott’s picture

Decided to merge this as it improves releasing locks without entity loads.

  • alexpott committed ec839b63 on 3.x
    fix: #3530760 \Drupal\content_lock\ContentLock\ContentLock::...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.