We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered Can't delete TV

  • Ever since the amsterdam server went down the other day, I'm not able to delete or remove a specific TV from a template without causing creating or editing resources to crash with a white screen or a "bad gateway" error. The TV isn't being used anywhere. Other dev installation on the same server don't have the problem, nor do any of my other MODx installations on other servers. I've checked the database, and the tables are all OK. This has taken me two days to pin down exactly what is causing the error, after losing several hours of work since the only resolution after deleting the TV was to restore the site from backup. Does anybody have any idea what's going on here?

    This question has been answered by sottwell. See the first response.

      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 3749
      • 24,544 Posts
      Maybe the attempt by MODX to remove the TVs related objects is what's going wrong (though normally, I think the TV would be removed before that point)?

      Can you use PhpMyAdmin on the cloud? If so, you could see if the TV has valid category, properties and source fields and is not locked.

      Have you tried removing it in code in a snippet?

      $tv = modx->getObject('modTemplateVar', array('name' => 'someName'));
      if ($tv) {
         $tv->remove();
      }
        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 can't remove it from template access, I can't change its type, I can't put it in a different category (although I can take it out of categories altogether) - any of these things will cause the blank page or nginx bad gateway error. Since it was already a text type, I just changed its name to "pageKeywords" and if I ever decide to add a keyword TV to the template's keywords meta tag I'll be all set. I'm not happy, though, because I have a nasty feeling that there's an instability somewhere that will come back and bite me someday.

        I did install phpMyAdmin for the cloud, and didn't see anything wrong anywhere, but it appears that restoring from a backup also removes the phpMyAdmin files. So the cloud still thinks it's installed (offers me an uninstall option that doesn't appear to work), but it doesn't exist.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 39501
          • 163 Posts
          @sottwell - Hope you get to the bottom of the problem. Only thing i've noticed since the downtime are a few NGINX gateway error messages when logging in to the manager.
          • I copied the site to localhost, and spent hours and couldn't get it to work. I replaced all core and manager files and folders. I removed all packages. I deleted everything except that TV. As long as the TV exists, is not in a category, and has access to the templates a resource is using, editing/creating resources works. Change any of those things, or changing its input type, and it either white-screens or gives a bad gateway error.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 39501
              • 163 Posts
              @sottwell - you could send me the cloud if you like, and I could see if I can replicate the problem?
              • I'd better not; the client wouldn't be real happy about that. I've finally gotten my email address straightened out with the MODx tech people, so it'll get sorted out.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 3749
                  • 24,544 Posts
                  Quite the mystery. Is that TV referenced in plugin code anywhere?
                    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
                  • No. I even disabled all plugins. The TV had not been used anywhere for some time; it had no values anywhere. A search through the file system didn't find any reference to it, nor did a search through the database. I couldn't find any difference between this TV and any other TV in the database. I do question the timestamp on the error log Jason reported via email (I got the same errors in my MAMP installation only with a more relevant timestamp) - what does America/Chicago have to do with a server in Amsterdam?

                    [18-Feb-2013 14:05:52 America/Chicago] PHP Fatal error: include(): Cannot redeclare class modtemplatevarinputrendertext in /blah/blah/etc/core/model/modx/modtemplatevar.class.php on line 413
                    [18-Feb-2013 14:05:52 America/Chicago] PHP Catchable fatal error: Argument 1 passed to xPDOObject::load() must be an instance of xPDO, instance of modX given in /blah/blah/etc/core/xpdo/om/xpdoobject.class.php on line 404
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 3749
                      • 24,544 Posts
                      It doesn't seem likely that a date/timezone mismatch would affect just one TV. mod_security? Does the TV have a suspicious name?
                        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