On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: BobRay at Mar 01, 2013, 11:57 PM
    I've submitted a feature request. If it goes through,
    Hi Bob,
    do you have any information if the feature request was 'accepted' you added over a month ago?

    What do you think who of the modx-core-team would be responsible for such a question / who we could ask about implementation of such a feature?

    My impression is that the core team is not as active here in the forum anymore as it used to be ...

    Thanks again for your work ...
    Letti
    • I have not heard anything (or, if I have, I've forgotten it). My guess is it would be OpenGeek, though I believe he is working on an extra that may address this issue.

        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
      • Hi Bob,

        as it doesn´t seem like the modx-team is going to implement something like $object->clearCache()

        is it possible for you to add a code-line to your plugin or make a plugin like cachemaster for plugins that deletes the cached files of a snippet when a snippet is saved?

        If the corresponding files in these folders are deleted on saving a snippet you would just have to uncheck 'clear cache on save' when working on a snippet and everything would be fine on saving a snippet:

        core/cache/includes/elements/modsnippet/
        core/cache/scripts/elements/modsnippet/

        What do you think about this?

        Letti
        • Hi Letti,

          Unless I'm misunderstanding you, CacheMaster 1.1.1 should handle that.

            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
          • I completely missed the new version. I was still using CacheMaster 1.0.3.

            But even updating to 1.1.1 it doesn´t work in our case. While selective cache clearing of a resource works really fine it doesn´t work with snippets.

            I tried it by changing the doSnippets to 'Yes' in the default Property Set and also in a new customized Property Set but it doesn´t work but in no case the two cached files of a snipped are not deleted.

            I also upgraded CHMOD of the two folders from 640 to 770 but this also leads to no deletion of the cached snippet-files in core/cache/scripts/elements/modsnippet/ and core/cache/includes/elements/

            Do you have any idea what I also could try to find the problem?

            • I'm afraid not, other than manually deleting all files in the core/cache directory to make sure you're running the current code. It worked when I last tested it, but that wasn't with the current version of MODX.

              Are you sure that the snippet files you're seeing in the cache contain the old code? They may be being updated there before you look at them.
                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
              • The snippet-files in cache/scripts/elements/modsnippet/ are deleted correctly but the files in core/cache/includes/elements/modsnippet/ were not deleted when saving a snippet.

                Is this maybe a bug or do you have an idea if there is any other setting in our installation which could be responsible for this behavior?

                Both folders are set to chmod 750.
                • That might qualify as a bug, but I'm not sure whether it's in CacheMaster or MODX. Calling the object method that clears the cache for that object should clear both files, IMO, but it looks like it doesn't. It could be, though, that there's something more CacheMaster needs to do in the process.

                  I'll try to check it out when I have time.

                    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
                  • Hi Bob,

                    maybe you remember that we were wondering why cachemaster doesn´t work for snippets. I think I found the problem. In the following part of the Code for deleting the cache-file of a single snippet the code deletes only the cached file in folder 'cache/scripts/elements/snippets/' and not in 'cache/includes/elements/snippets/' because it is missing in the part of the code as copied below.

                    BTW: In our installation it is only necessary to delete the cached file in the 'include-folder'. Therefore it might be enough to only replace in the given path 'scripts' by 'includes' and changing the file-name into '.include.cache.php' and changing 'snippets' into 'modsnippet'. At least this was successful in our settings.

                    Thanks a lot again for this really excellent add-on ...

                    case 'OnBeforeSnipFormSave':
                    
                            $docId = $snippet->get('id');
                    
                            /* set path to default cache file */
                            $path = MODX_CORE_PATH . 'cache/scripts/elements/snippets/' . $docId . '.cache.php';
                    
                            $cKey = $snippet->getScriptCacheKey();
                            if ($doDebug) {
                                my_debug('Cache Key: ' . $cKey);
                            }
                            $modx->cacheManager->delete($cKey, array(
                                xPDO::OPT_CACHE_KEY => $modx->getOption('cache_scripts_key', null, 'scripts'),
                                xPDO::OPT_CACHE_HANDLER => $modx->getOption('cache_scripts_handler', null,
                                    $modx->getOption(xPDO::OPT_CACHE_HANDLER)),
                                xPDO::OPT_CACHE_FORMAT => (integer)$modx->getOption('cache_scripts_format', null,
                                $modx->getOption(xPDO::OPT_CACHE_FORMAT, null, xPDOCacheManager::CACHE_PHP))
                            ));
                            break;
                    • That sounds right to me. Thanks for finding it. It may be a while before I can get to it, though.
                        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