We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38290
    • 712 Posts
    Next version of Articles will have a checkbox allowing you to prevent Articles from clearing cache on save. Patience is all you need smiley
      jpdevries
      • 42562
      • 1,145 Posts
      This is excellent news; in faith it is.

      I'll also hope the next version lets the article rebuild its own cache besides including the option for clearing the site's cache.
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 38290
        • 712 Posts
        Not possible for Articles to have it's own cache. Remember, Articles are really just fancy resources.

        Quote from: donshakespeare at Apr 25, 2013, 11:00 AM
        This is excellent news; in faith it is.

        I'll also hope the next version lets the article rebuild its own cache besides including the option for clearing the site's cache.
          jpdevries
          • 16430
          • 217 Posts
          To Bob Ray:
          Why not just simply delete cache folder and file for newly created resource and its parent?
             $id[0] =  $doc->get('id');       //current resource
             $parentid =  $modx->getParentIds($id[0], 1, array('context' => 'web'));  //arrays of parents
             $id[1] = $parentid[0];      //first parent
             
             foreach($id as $docId) {
            $ctx = $modx->resource->get('context_key');
              /* set path to default cache file */
            $dir = MODX_CORE_PATH . 'cache/resource/' . $ctx . '/resources/' . $docId;
            $cache_file = MODX_CORE_PATH . 'cache/resource/' . $ctx . '/resources/' . $docId . '.cache.php';
            unlink($cache_file); //delete file  cache.php
            foreach(scandir($dir) as $file) {    //delete folder and content
              if ('.' === $file || '..' === $file) continue;
              if (is_dir("$dir/$file")) rmdir_recursive("$dir/$file");
              else unlink("$dir/$file");
            }
            rmdir($dir);  
             } 

          This code works, but it throws error when I embedd it in Upload snippet posted earlier... It works without second "foreach" !!??!!
            • 3749
            • 24,544 Posts
            @kudykam - That will work with the default cache, but people can use alternate cacheing schemes.

            @jpdevries - Once the checkbox exists, CacheMaster may (or may not) work with Articles.
              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
              • 42562
              • 1,145 Posts
              Yea, if CacheMaster does not then work with Articles, and Articles does not then have its own mechanism for the selective clear issue, I'm afraid the new feature would be irrelevant in this case...and then back to square zero with complaints on the matter.
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 38290
                • 712 Posts
                The new feature I mentioned makes Articles like normal Resources, you can tell it not the clear the cache on save. It's on GitHub for anyone that would like to test (on a testing site of course)
                  jpdevries