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
    I’d love to see a little health check built-into the manager. It may be prohibitive to run lots of tests during each page load in the manager, but it would extremely helpful to have a menu item somewhere to optionally run a whole slew of tests. Most importantly would be:

    1. Test permissions on the site. So many errors I’ve encountered were identified correctly when I re-ran setup because the setup process does a lot of tests, especially for the permissions on files/folders
    2. Test for existence of/basic correctness of the .htaccess file -- if you have friendly URLs enabled but you somehow toasted your .htaccess file, you end up 404’ing all over the place without knowing why.
    3. Test database connectivity and collations/charset. The basics of this are tested in the setup process, but I think you could take it a step farther and identify potential problems like if you created a new custom table and gave it the incorrect encoding.
    4. PHP memory issues -- again, this is in the setup
    5. Others?


    In short, all the tests in the setup process should be optionally available in the manager. This is especially useful when moving a site between servers (as in the dev/prod dev cycle).
      • 22840
      • 1,572 Posts
      Would love to see that.

      One thing I miss from the latest version of evo is that in the settings there is a button you can click to update the paths, would love to see that in revo smiley
        • 25663 MODX Staff
        • 12,272 Posts
        I think this bears an official feature request, with specifics, in the issue tracker. It’ll get lost in the forums, but please feel free to discuss more before making the issue. Great suggestion!

          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          Added: http://bugs.modx.com/issues/3253

          It may seem dramatic, but I put this as a major feature request because soooo many bugs and other issues are fixed by those tests from the setup scripts.
            • 25663 MODX Staff
            • 12,272 Posts
            How would you go about testing htaccess ... and likewise nginx rewrite and IIS rewrite rules? Thinking that could get fairly complex given all the variables...

            Let’s keep the discussion going and update the report with additional info. Thanks Everett.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              Well... first, I would test to see if .htaccess or web.config etc. even exists -- that’s not a sure-fire test, but 90% of the time I bork friendly URLs because I deleted that file or forgot to copy it because I used a GUI program to copy only *visible* files. So that could be one test to produce a warning like "Dude, I don’t know what web server you are using, but we can’t figure out how you are making your rewrites work, and that could mean your friendly URLs are broken".

              But a more elegant test that avoids directly testing the specific webserver process altogether might be something like this:

              Use file_get_contents() (or curl) to request any aliased page on your site (not the 404 page or the home page). Then compare the rendered contents of this page to the MODx rendering of that page using the xPDO API. The two strings should match if the public page w/ friendly URL matches the internally generated page.

              E.g.
              // Pseudo code here
              $what_the_world_sees = file_get_contents('http://mysite.com/some/page');  
              $what_modx_sees = $modx->somePageGettingFunction(123);
              
              // strip out whitespace ?? Other cleanups to make for better comps?
              
              if ($what_the_world_sees != $what_modx_sees) 
              {
                 // throw error
              }
              


              Caveats might include Plugins that inject modified content into the page if you are logged into the manager. Maybe the test should request the page via the normal friendly URL and via index.php?id=123 and compare the strings generated by that.

              Alternatively, you could examine the $what_the_world_sees string to see if it contains any known Apache/IIS/nginx error messages, but I think the above approach would be better.