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
    I’ve been looking at porting an existing site to Revolution to give it a shakedown. The site has manager users, web users, MaxiGallery, Wayfinder, file uploads, custom snippets, Personalize, Ditto, SPForm, and multiple templates so it would give Revolution a good ride. I have the latest Revolution up and running but with no content.

    Obviously, I can cut and paste everything into the new site, but I’m wondering if I can use some shortcuts (and possibly develop a conversion script).

    The site_content table looks to be the same except for the addition of the class_key and context_key fields and the renaming and restructuring of the contentType/content_type field. There are also a few changes from int(1) to tinyint(1) and vice versa although I’m guessing those shouldn’t be an issue.

    Is it possible to dump the site content table and import it into the new site after editing the dump to drop contentType, add the three new fields, and modify the snippet and chunk calls appropriately? Or would that be a suicidal undertaking? If it’s possible, what should go in the new fields?

    I imagine there would have to be some editing of the permissions numbers and the groups would have to be done from scratch.

    Is the site_content table modular enough that it can be imported on its own, or does document creation modify other tables that would make this move unwise?

    Are there any other tables that could be imported this way (member_groups, membergroup_names, document_groups, documentgroup_names, site_templates, site_snippets, site_htmlsnippets?

    Any thoughts appreciated.

    Bob
      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
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: BobRay at Jan 22, 2008, 04:10 PM

      I’ve been looking at porting an existing site to 0.9.7 to give it a shakedown. The site has manager users, web users, MaxiGallery, Wayfinder, file uploads, custom snippets, Personalize, Ditto, SPForm, and multiple templates so it would give 0.9.7 a good ride. I have the latest 0.9.7 up and running but with no content.

      Obviously, I can cut and paste everything into the new site, but I’m wondering if I can use some shortcuts (and possibly develop a conversion script).
      First, checkout the class modTranslator (a wrapper for the utility class modTranslate095), and an example conversion script I used to jump-start the process of translating Wayfinder 2.0 to Revolution. After running this, only a very few things had to be adjusted in the script, and these are things that will either be fully documented in a migration guide or refactored/fixed so the change is not necessary when we finally release this.

      Quote from: BobRay at Jan 22, 2008, 04:10 PM

      The site_content table looks to be the same except for the addition of the class_key and context_key fields and the renaming and restructuring of the contentType/content_type field. There are also a few changes from int(1) to tinyint(1) and vice versa although I’m guessing those shouldn’t be an issue.

      Is it possible to dump the site content table and import it into the new site after editing the dump to drop contentType, add the three new fields, and modify the snippet and chunk calls appropriately? Or would that be a suicidal undertaking? If it’s possible, what should go in the new fields?

      Is the site_content table modular enough that it can be imported on its own, or does document creation modify other tables that would make this move unwise?
      The aforementioned modTranslator will handle conversion of old tags to new accurately in probably 95% of all cases, with most of the false positive matches occurring in snippets where valid PHP code can match some of the legacy tags.

      As for the site content, just dump using complete and extended insert options, import, and add a class_key of modDocument (or modWebLink) and match the content_type fk to the appropriate match in the content_type table, which will likely be 1 (which should be the HTML content type record) for most modResources (modDocument, modWebLink, etc.); you can actually use contentType to find a match in content_type table as the value in site_content.contentType will match the content_type.mime_type field (these are kept in sync for now to allow new functionality without sacrificing legacy dependency on the contentType column).

      Quote from: BobRay at Jan 22, 2008, 04:10 PM

      I imagine there would have to be some editing of the permissions numbers and the groups would have to be done from scratch.
      This is a whole other can-of-worms, and I’m working on migration strategies to ease the transition along with scripts to help automate these strategies when moving to the new security framework I’ve just recently implemented on top of the merged web/manager user model.

      Quote from: BobRay at Jan 22, 2008, 04:10 PM

      Are there any other tables that could be imported this way (member_groups, membergroup_names, document_groups, documentgroup_names, site_templates, site_snippets, site_htmlsnippets?
      Start with the translator class and your manual site_content (i.e. modResource) import and we’ll go from there. wink

      The installer will eventually include interfaces to these and possibly other tools to help most 0.9.6’ers easily migrate their sites through a series of steps born out of best practices we develop here in collaboration.
        • 3749
        • 24,544 Posts
        Excellent!

        Just a couple of quick questions to start out:

        1. I can’t find the actual translate() function. Did I miss it, or is it in another file?

        2. Is the script meant to work on the SQL dump file for the whole site, selected tables, or something else?

        Bob


          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
          • 22303 MODX Staff
          • 10,725 Posts
          For some reason I missed the topic notification until now; sorry BobRay...
          Quote from: BobRay at Jan 23, 2008, 09:23 AM

          1. I can’t find the actual translate() function. Did I miss it, or is it in another file?
          translateSite() is the actual function that performs the translation. You can have it just create a log of the changes it would make, or run it to actually modify the database and/or file content you specify.

          Quote from: BobRay at Jan 23, 2008, 09:23 AM

          2. Is the script meant to work on the SQL dump file for the whole site, selected tables, or something else?
          This API allows you to include any tables/fields represented by/in xPDOObject classes, directories (with optional file extension filters), and/or specific files.

          I’m thinking separate migration packages for coming from previous releases (oooh, and/or other products maybe?) might be the way to go, rather than trying to stuff all that into the regular installer.
            • 3749
            • 24,544 Posts
            Quote from: OpenGeek at Jan 23, 2008, 08:52 PM

            For some reason I missed the topic notification until now; sorry BobRay...
            Topic notification has been a little quirky for me too lately

            Quote from: BobRay at Jan 23, 2008, 09:23 AM

            1. I can’t find the actual translate() function. Did I miss it, or is it in another file?
            translateSite() is the actual function that performs the translation. You can have it just create a log of the changes it would make, or run it to actually modify the database and/or file content you specify.

            This is what I was looking for (and still haven’t found):

            $parser->translate($content)


            It appears to be where the real work is done and where most new code/bug fixes would go.

            It comes from here:

            function getParser() {
                    if (!is_object($this->parser) || !is_a($this->parser, 'modParser095')) {
                        $this->parser= & $this->modx->getService('parser095', 'modParser095');
                    }
                    return $this->parser;
                }


            but I don’t know if parser095 and modParser095 are built-in or your own code (which I’d need for the next step).
            I’m feeling particularly dense this morning so I hope these aren’t stupid questions.

            It’s just that I don’t see any code in what you’ve shown me that actually does the translation of, say,
            {{chunk}} to [[$chunk]] or [!snippet!] to [[!snippet]].



            I’m thinking separate migration packages for coming from previous releases (oooh, and/or other products maybe?) might be the way to go, rather than trying to stuff all that into the regular installer.

            Agreed.


            Bob
              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
              • 22303 MODX Staff
              • 10,725 Posts
              modParser095 is what you are looking for BobRay, as included by the modTranslate095 code you alluded to...

                • 3749
                • 24,544 Posts
                Quote from: OpenGeek at Jan 24, 2008, 10:10 AM

                modParser095 is what you are looking for BobRay, as included by the modTranslate095 code you alluded to...


                Thanks, it’s starting to make sense to me now.

                Bob
                  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
                  • 3749
                  • 24,544 Posts
                  Jason,

                  Do you think a simple GUI front-end for this would be worth the effort?

                  Bob
                    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
                    • 25663 MODX Staff
                    • 12,272 Posts
                    BobRay, definitely!
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 14050
                      • 788 Posts
                      BobRay,

                      If you could also try and document your efforts and either make a posting here or a Wiki posting. I would be very interested in your efforts or a tutorial smiley
                        Jesse R.
                        Consider trying something new and extraordinary.
                        Illinois Wine

                        Have you considered donating to MODx lately?
                        Donate now. Every contribution helps.