We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    The request would be for both generic API methods and for a system event that fires when someone clears locks. Why this is hugely important is so that custom manager pages can lock down custom resources (e.g. 3rd party custom database tables). Right now, if someone is editing records in my custom database tables, there is the possibility for user collisions -- one user overwriting the work of another = hugely problematic. I could come up with my own locking mechanism, but it’s a bad user-experience to have to use a separate menu item to clear *my* locks as opposed to clearing MODx locks. Does that make sense?

    The pieces are already there in the core.... why not make them available to the custom components in the same way that you can add MODx permissions to your CMP’s by creating an action.
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Do you know how MODx is handling the locking of a resource now? It doesn’t appear to be updating a column on the site_content table, so it must be storing the lock somewhere else...
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Looking at /model/modx/modresource.class.php I see that xPDO is using its registry for this very task... perhaps I can tie into this after all (around line 416):

        $this->xpdo->registry->locks->subscribe('/resource/');
        $this->xpdo->registry->locks->send('/resource/', array(md5($this->get('id')) => $user), array('ttl' => $this->xpdo->getOption('lock_ttl', $options, 360)));


        The big question will be whether or not the default MODx "clear locks" menu item flushes the registry here as we suspect it does...