We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Guys I think I just wiped a snippet.
    I was using dreamweaver to build up a snippet, and I open the wrong snippet and pasted over the old one and saved.

    Im not sure I can restore the DB to yesterday.
    Am I now in a world of pain? can I get the old snippet back!?!
      • 10487 MODX Staff
      • 1,535 Posts
      Don’t use Dreamweaver myself but doesn’t it have some kind of Undo History option built-in? I seem to remember it having something like that from a distant past.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 15083
        • 697 Posts
        Hi there,

        The problem is I overwrote a snippet and saved it.
        The cache has the new snippet, and I dont save the outside of the MODx DB, I should now start!

        I beginning to think im in trouble.

        Cheers,

        Justin
          • 10487 MODX Staff
          • 1,535 Posts
          Ah, I see now - without a DB backup I think you’re going to struggle getting it back.
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 37550 ☆ A M B ☆
            • 711 Posts
            Oops

            I’ve made this mistake myself before was copying and pasting between MODx snippet editor and my desktop IDE.

            If your website is with a hosting company you could ask them if they could provide you with last nights database backup which you could restore and get the snippet out.
              http://www.onesmarthost.co.uk
              UK MODX Hosting with love.
              • 26931
              • 2,314 Posts
              not sure....
              when this file was within your xampp/mamp environment, and you are working on windows, there’s a function "restore system" where you can select a date to which your system should be restored to, normally it doesn’t affect your files, but i think it might be when those files are within a server environment
                • 37550 ☆ A M B ☆
                • 711 Posts
                Quote from: sharkbait at Jul 29, 2009, 08:06 AM

                not sure....
                when this file was within your xampp/mamp environment, and you are working on windows, there’s a function "restore system" where you can select a date to which your system should be restored to, normally it doesn’t affect your files, but i think it might be when those files are within a server environment

                Windows system restore will only roll back system state and not roll back any user files created.
                  http://www.onesmarthost.co.uk
                  UK MODX Hosting with love.
                  • 26931
                  • 2,314 Posts
                  i know...thought i noticed it within my server environment files
                    • 15083
                    • 697 Posts
                    Well my only thought was that it would still be in my sitecache...but alas it was not.
                    Lesson learned:

                    *Set up backups for all DB’s
                    *Copy snippets locally!

                    I just use dreamweaver as its easier to read the php, format it etc...
                    I have since redone my snippet, obviously a little quicker as it was the second time around :0
                      • 5340
                      • 1,624 Posts
                      this is how my snippets look like wink

                      <?php
                      include_once( $modx->config['base_path']."assets/snippets/contactList.php");
                      ?>