We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4749
    • 623 Posts
    These ideas all sound fantastic. Gotta love the ModX community where many heads are better than one.
      The MODx has you...
      Utah Web Design
      • 34017
      • 898 Posts
      couldnt you also use something like

      if MODX is not defined {
      exit();
      }
        Chuck the Trukk
        ProWebscape.com :: Nashville-WebDesign.com
        - - - - - - - -
        What are TV's? Here's some info below.
        http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
        http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
        • 33372
        • 1,611 Posts
        Something like that would probably be a good idea to add to the beginning of all custom includes.
        if (!defined('MODX_MANAGER_PATH')) die('you gravy-sucking pig');

        (OK maybe the output message should be a tad more informative.)

        MODX_MANAGER_PATH is a constant which absolutely should have been set when the config file was loaded, and constants are much more resistant to having their values changed accidentally. Also it seems to me as if there may be some instances in which you’d need to first have a global $modx; statement (e.g., if the include were inside a function) before testing for that object’s existence, and that would defeat the purpose.

        This might also be a useful second line of code:
        require_once(MODX_MANAGER_PATH.'/includes/protect.inc.php');
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 24719
          • 194 Posts
          great work guys, thanks so much.

          i’d been pulling my hair out because on our site with over 22,000 docs, the cache file was 6mb, but php was allocating over 80mb of ram. now, the cache is loaded into only 9mb. woohoo!
            • 1611
            • 591 Posts
            @redman
            wow! 22 000! it’s a bit more than 5000 smiley
            Did you do any hacks on core (besides this) or anything else?
              • 24719
              • 194 Posts
              just memcache things as much as possible, and i think the occasional extra index on tables here and there.
                • 25663 MODX Staff
                • 12,272 Posts
                Would be interested to know your indexes, and potential pitfalls if doing that to smaller sites.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 25663 MODX Staff
                  • 12,272 Posts
                  On a related topic, I wonder if it would be possible/helpful to split the document cache from the Element cache. Snippets, Templates, Chunks, etc. are all far less likely to change frequently, so the document cache file would need to process/write less during clearing the cache. My understanding too is that this might further have benefits with opcode caching like eAccelerator. Thoughts?
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: rthrash at Jun 13, 2009, 09:09 AM

                    On a related topic, I wonder if it would be possible/helpful to split the document cache from the Element cache. Snippets, Templates, Chunks, etc. are all far less likely to change frequently, so the document cache file would need to process/write less during clearing the cache. My understanding too is that this might further have benefits with opcode caching like eAccelerator. Thoughts?
                    It is split in Revo, but you still have limitations; the quantity of Documents/Resources is always going to be the bottleneck. Having the elements in the same cache file is more like insult to injury in this case, and though it buys a little more space, the problem is ultimately the same. Once you hit a certain number of them, performance is better without caching the various lists of Documents/Resources at all, especially if you use page caching properly.