We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18174
    • 116 Posts
    This will simply delete the cache file for that resource.
    Which resource? I have to render every Resource's TV to select my plugin condition. As I see this, this would end up with every page uncached.
    As I look into your code below, could this be a context issue? I hope I stated this at the beginning of this threat, this bug happens in a multi context environment. As I look into the cache of my > 200 pages site, in every context cache (if there is any) is only one file called 1.cache.php. And in there is the content of resource id=1, the entry page of context "web", which surely is wrong.
      • 18174
      • 116 Posts
      Correction:
      The 2nd installation is not multi context. There are further contexts but only context "web" is used.
        • 3749
        • 24,544 Posts
        Quote from: manu37 at Sep 06, 2013, 03:40 AM
        This will simply delete the cache file for that resource.
        Which resource? I have to render every Resource's TV to select my plugin condition. As I see this, this would end up with every page uncached.

        Sorry, I thought your plugin was only operating on the current resource, which would be available with $modx->resource in the front end. I was thinking that the resource would already have been loaded from the cache, but you're right, it would then become uncached for the next visit.

        Here is something else to try. It's hacking the core code, but I think it might work.

        In this code in the core\model\modx\modtemplatevar.class.php file:

        $resource = $this->xpdo->getObject('modTemplateVarResource',array(
                            'tmplvarid' => $this->get('id'),
                            'contentid' => $resourceId,
                        ),true);


        Change that final true to false. That *should* get the TVR from the DB instead of the cache.

        If that works, maybe $tv->getValue() and $tv->RenderOutput() should have a $cacheFlag argument added.
          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
          • 18174
          • 116 Posts
          Hi Bob
          I regret, but still no effect.
          I changed line 193 in getValue method in modtemplatevar.class.php as you said, but still faulty caching.
            • 3749
            • 24,544 Posts
            I don't have an SSL install, so I can't test any of this.

            You tried the following (with the cache flag set to false?):

            $resource = $this->xpdo->getObject('modTemplateVarResource',array(
            'tmplvarid' => $this->get('id'),
            'contentid' => $resourceId,
            ),false);

            I'm surprised that didn't work. Maybe the problem is with the Resource ID being out of date rather than the cached TV value. Have you checked it? [ed. note: BobRay last edited this post 13 years ago.]
              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
              • 18174
              • 116 Posts
              It has nothing to do with SSL. Even the rendered TV's are put out correctly.
              After the renderOutput I write $modx->resourceIdentifier to the logfile. All reported Id's are correct.

              I have two different phenomenons on the two installations (I just don't know how the cache structure is built up).
              Install 1 correct caching:
              inside core/cache/resource/web/resources/ the id.cache.php and their directories named with the resource id look correct.
              Install 1 incorrect caching:
              the id.cache.php's are missing. In the directories named with the resource id the other cached items (snippet calls) seem correct but not proved.

              Install 2 correct caching:
              Cannot be proved because it's a life system with SSL redirect (which works correctly).
              Install 2 incorrect caching:
              In each context's core/cache/resource/context/resources/ there's only one file called 1.cache.php, which contains the mistaking resource 1 (an no directories because there are no cached calls in this resource?).

              I hope I explained this case clear enough.

              I wonder why not anybody else take the few lines of my code published in the bugtracker and reproduce this error. Its a matter of on single minute. I wonder why not andybody else (except you,thx Bob!) is concerned about this which lasts since mid june. IMHO this is a major issue.
                • 3749
                • 24,544 Posts
                I've been meaning to ask -- how are the new TV values being set? If it's in code, can you post the code?

                Also, let me restate your problem to make sure I understand it ("incorrect caching" is a little vague).

                You set a new value in a TV (how?), and in your plugin attached to OnWebPageInit, you get the old value of the TV when calling $resource->getTVValue(). Is that correct?

                You also said that this only happens when the RevoSSL plugin is enabled. Is that still true?
                  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
                  • 18174
                  • 116 Posts
                  Quote from: BobRay at Sep 09, 2013, 02:52 AM
                  You set a new value in a TV (how?), and in your plugin attached to OnWebPageInit, you get the old value of the TV when calling $resource->getTVValue(). Is that correct?

                  You also said that this only happens when the RevoSSL plugin is enabled. Is that still true?
                  The TV's are set by the manager page (edit resource), output pref is "default" and they are eventually inherited. Even with $resource->getTVValue() and $tv->renderOutput() I get the correct output of the TV (put out in log file). The plugin itself runs as expected. RevoSSL has nothing to do this this issue. RevoSSL itself runs as expected. In conjuction with it I just found out this problem which I reduced to the code I published in bugtracker.
                    • 18174
                    • 116 Posts
                    FYI
                    As I suspected a xPDO issue, I upgraded to 2.2.9, but still no effect.
                      • 3749
                      • 24,544 Posts
                      That's really strange. Saving the Resource should clear the cache for that Resource. You're not using CacheMaster or some other caching plugin by any chance are you?

                      Any plugins connected to OnBeforeDocFormSave?


                      What happens when you set the default value of the TV to

                      @INHERIT

                      or

                      @INHERIT some value
                        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