We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    It looks right to me, although *.php at the end would be faster.

    Try this one, it should give you a lot of hits and you might find the culprit:

    fgrep -r "getObject('modTemplate'" *.php


    The offending code could also be in a where clause, which would be little harder to find.
      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
      • 34004
      • 125 Posts
      Thanks Bob. I've run the grep search and this is everythign that comes back: http://pastebin.com/fj0PkbZX

      I've disabled/removed Batcher, Handyman and all other not used addons. I can't remove Articles as my blog runs on it. I've cleared the cache afterwards and still Templates aren't showing in the tree (seems to be templates at the root level, I can see templates within categories)

      Any ideas from the above grep output?
        • 3749
        • 24,544 Posts
        These are the only two that could do it, and they seem unlikely:

        public_html/core/model/modx/processors/security/forms/set/import.php:    $template = $modx->getObject('modTemplate',array(
        
        public_html/core/model/modx/processors/resource/create.class.php:        $this->template = $this->modx->getObject('modTemplate',$templateKey);


        The first would be called very seldom.

        The second could be it if somebody is calling runProcessor('resource/create') with the $templateKey field set to an array using 'name' => 'something', but $templateKey would normally be just an integer, so I think that's unlikely too. It would be very difficult to search for since $templateKey could be named anything on the sending end and the processor in the runProcessor() call could be dynamic (e.g, runProcessor($processorPath) ).

        You would have to grep 'resource/create', then load all the files, view all the instances, and look at how the fields for the second argument to runProcessor were set.

        It's too bad that the error in the log doesn't include the call stack. I think if you turn on PHP error reporting and set the level to:

        ini_set('display_errors', 1);
        
        error_reporting(E_ALL);
        
        // or 
         
        error_reporting(E_ALL ^ E_NOTICE);
        

        You may get things to crash when it happens and you'll see a call stack that should tell you exactly where the error is coming from.


        [ed. note: BobRay last edited this post 12 years, 6 months 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
          • 34004
          • 125 Posts
          Thanks for your help Bob. I've grepped 'resource/create' and it returns hundreds of files, so that's not really going to work to open up every one.

          I've turned on reporting and there have been no crashes so far, but I will keep an eye on that error_log over the next 12 hours in the hope something related will appear.

            • 34004
            • 125 Posts
            I've had a look in the error_log and here are the errors:

            [15-Mar-2014 02:54:46] PHP Warning:  Invalid argument supplied for foreach() in /home/centurio/public_html/core/components/modmailchimp/elements/snippets/snippet.modMailchimp.php on line 325
            [15-Mar-2014 03:02:24] PHP Warning:  implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in /home/centurio/public_html/core/components/getpage/include.getpage.php on line 35
            


            They're the only two issues in the error log (over and over again) and I have disable both modmailchimp and getpage and I still can't see templates in the tree. I am going to update modx to latest version tonight in the hope it fixes it. May have to get some professional paid for MODx help if I can't fix this one...
              • 34004
              • 125 Posts
              FIXED. Upgraded to 2.2.13 and that solved it...
                • 3749
                • 24,544 Posts
                I'm glad you got it sorted. Thanks for reporting back. smiley
                  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