On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Ok perfect! I can live with "very small". 0 chance would be ideal, but realistically the chances of having several people hit save all at the same time is pretty low. They will all most likely be at least a couple seconds apart if not more. Of course this gets skewed with the more people I have trying to save, database lag, connection lag, etc. At most I think it would only ever be 3 to 5 people.

    However, now that I think about it more, having previous TV's wiped out would be very very bad in this situation. Even if there's a 0.001% chance it could happen that is enough for me to consider an alternate method. Maybe I'll look in to modUsers some more. On top of this, it's all going to be done over a poor wifi connection which could mean taking 5 to 10 seconds to perform the save. I'm not sure if this is an issue or not as I presume NP fetches / writes TV's pretty much instantaneously server-side regardless of how long a client connection is taking?

    Thanks,

    K.


    • I would expect that the time between fetching the TVs and saving them again would be well under a second. You could measure it on your server if you want to.

      Put this code just above the code I posted earlier:

      $mtime = microtime();
      $mtime = explode(" ", $mtime);
      $mtime = $mtime[1] + $mtime[0];
      $tstart = $mtime;


      And this code just below the runProcessor('resource/create') call:

      $mtime = microtime();
      $mtime = explode(" ", $mtime);
      $mtime = $mtime[1] + $mtime[0];
      $tend = $mtime;
      $totalTime = ($tend - $tstart);
      $totalTime = sprintf("%2.4f s", $totalTime);
      echo .=  "<br />Total Time: " . $totalTime;
      


      I'm not sure if you'll see the output, you may have to write it to the error log or to a chunk.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • Bob/Kevin,

        To chip in on the initial problem you were trying to solve. I had exactly the same issue, whereby submitting the edited form resulted in the form being redisplayed without saving, or error. I added a bit of debugging to chunks and snippets and discovered that the conditional output modifiers for the error messages weren't behaving in npOuterTpl. For example:

        [[!+np.errors:ifnotempty=`[[!+np.errors]]`]]


        Even though np.errors was not empty, it wasn't being rendered. I've removed the conditions from the placeholders and the reasons for the form not being saved are now being displayed:

        [[!+np.errors]]


        I've noticed inconsistencies between installations or versions for conditional output before, but nothing that I could explain or be bothered looking into. Anyhow - looks like I have NewsPublisher working as I want, I just need to remove the validation for 'content' not being present (intentional) in my edit form!

        Thanks both for your contributions
        Andrew