We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I am trying to understand the document publishing system. From what I can see, the value in sitePublishing.idx.php is set to the lowest pub_date, and when every document is parsed this value is checked. If it’s that time, then all documents are checked in the database, and any document with a current pub_date timestamp gets its published status changed, and the value in the sitePublishing file gets changed to the next lowest pub_date value. But I can’t find where this value is set in the first place, when a document is saved.

    So it would be possible that, say, an Ajax-based query to the site_content table could find the document unpublished when in actuality it should be published. But the chances of this happening would be vanishingly slight, and the condition would be corrected within a very short time (unless it’s a really dead site). Am I correct in my thinking?

    I’m also wondering what’s the advantage of using a file for this and not a field in the system_settings table? It would be read a great deal more than written, and that table is read every time the parser runs anyway. It would save opening and reading a file every time a document is parsed.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • Interesting Susan. Do you think this might have something to do with slightly overloaded servers, really complex sql queries and the mysterious caching bug: http://modxcms.com/forums/index.php/topic,2975.30.html
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • I suppose it could cause some odd results if it got hit at just the wrong moment, especially on a mass-hosting system where the poor hard drive is getting jerked around unmercifully as it is.

        Another good reason for moving the value into the system_settings, since it’s one less trip to the file system and would automatically be available as soon as the parser loads the config array. This would make no difference to users, it would just be an internal modification. The database updates would be relatively rare, but this value is read on every document’s parsing. Perhaps a miniscule speed boost, but on a busy site running to the file system to open and read a file for every page would add up.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • This sounds really interesting to me. Perhaps it could even store an array of documents and pub dates so it’s not depending on the least common denominator.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • Yes, and this way the query wouldn’t be checking ALL documents, only those with pub_dates.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org