Sep 08, 2008, 11:08 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Donate to MODx: Donations
Pages: [1] 2 3 ... 6   Go Down
  Print  
Author Topic: Migrating to Revolution  (Read 9910 times)
0 Members and 1 Guest are viewing this topic.
BobRay
Coding Team
*
Posts: 1,246


WWW
« on: Jan 22, 2008, 04:10 PM »

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
« Last Edit: Jul 15, 2008, 09:42 AM by splittingred » Logged

MODx info for newbies: http://bobsguides.com/MODx.html
OpenGeek
MODx Co-Founder
Moderator
*
Posts: 4,675


looking a little more like my avatar again...


WWW
« Reply #1 on: Jan 22, 2008, 11:36 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.

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).

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.

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.
« Last Edit: Jul 17, 2008, 09:44 AM by splittingred » Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
BobRay
Coding Team
*
Posts: 1,246


WWW
« Reply #2 on: Jan 23, 2008, 09:23 AM »

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


Logged

MODx info for newbies: http://bobsguides.com/MODx.html
OpenGeek
MODx Co-Founder
Moderator
*
Posts: 4,675


looking a little more like my avatar again...


WWW
« Reply #3 on: Jan 23, 2008, 08:52 PM »

For some reason I missed the topic notification until now; sorry BobRay...
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.

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.
Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
BobRay
Coding Team
*
Posts: 1,246


WWW
« Reply #4 on: Jan 24, 2008, 09:20 AM »

For some reason I missed the topic notification until now; sorry BobRay...
Topic notification has been a little quirky for me too lately
Quote
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):

Code:
$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:

Code:
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,
Code:
{{chunk}} to [[$chunk]] or [!snippet!] to [[!snippet]].

Quote
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
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
OpenGeek
MODx Co-Founder
Moderator
*
Posts: 4,675


looking a little more like my avatar again...


WWW
« Reply #5 on: Jan 24, 2008, 10:10 AM »

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

Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
BobRay
Coding Team
*
Posts: 1,246


WWW
« Reply #6 on: Jan 24, 2008, 01:52 PM »

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
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
BobRay
Coding Team
*
Posts: 1,246


WWW
« Reply #7 on: Jan 24, 2008, 10:19 PM »

Jason,

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

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
rthrash
Foundation
*
Posts: 9,106



WWW
« Reply #8 on: Jan 24, 2008, 10:26 PM »

BobRay, definitely!
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
Jesse R.
Coding Team
*
Posts: 778


WWW
« Reply #9 on: Jan 25, 2008, 08:24 AM »

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
Logged

Jesse R.
Consider trying something new and extraordinary.
Illinois Wine

Have you considered donating to MODx lately?
Donate now.  Every contribution helps.
splittingred
Moderator
*
Posts: 305


i am alt-country rock


WWW
« Reply #10 on: Jan 25, 2008, 09:07 AM »

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

Excellent idea!

Also, you might be interested in how to do this in the 097 manager with Ext2. We're putting up a documentation/tutorial site for this:

http://docs.modxcms.com/modext/

It's in-progress, but should help a lot with how to use modExt (MODx's Ext implementation) properly and effectively.


Also, you'll probably want to look into modAction and modMenu for creating the controllers and menu items for the section.
Logged

OpenGeek
MODx Co-Founder
Moderator
*
Posts: 4,675


looking a little more like my avatar again...


WWW
« Reply #11 on: Jan 25, 2008, 09:18 AM »

Are we thinking an inside the manager interface is the right way to present this?  i.e. install the new MODx and then run the migration script on an old database/file-system location?
Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
rthrash
Foundation
*
Posts: 9,106



WWW
« Reply #12 on: Jan 25, 2008, 09:30 AM »

Jason I think that sounds like a great idea in getting the site up and "proving" the core functions. Then the old site could be "imported". Would be pretty darned cool and also facilitate sucking in those other types of sites as you mentioned here/elsewhere ... slurp up your Wordpress blog entries under a specific container anyone? Ready to migrate from Joomla/Nuke/whatever? Fill out your DB credentials in this form, or locate your SQL dump and press this button ... Tongue
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
BobRay
Coding Team
*
Posts: 1,246


WWW
« Reply #13 on: Jan 25, 2008, 09:50 AM »

Are we thinking an inside the manager interface is the right way to present this?  i.e. install the new MODx and then run the migration script on an old database/file-system location?

I was thinking standalone app., since the user will have to go outside of MODx to dump the SQL from the old site.  It could certainly be done in the Manager but that would slow development some and make debugging more difficult.

If it works as a standalone, could it be integrated into the Manager later?

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
OpenGeek
MODx Co-Founder
Moderator
*
Posts: 4,675


looking a little more like my avatar again...


WWW
« Reply #14 on: Jan 25, 2008, 10:02 AM »

I was thinking standalone app., since the user will have to go outside of MODx to dump the SQL from the old site.  It could certainly be done in the Manager but that would slow development some and make debugging more difficult.
There is no SQL dump involved.  Everything in this script is done via xPDO objects or directly to files.  And it could be distributed separately, but would be useless without the core install available and running and the app configured to point at the core location.
Logged

Jason Coward
MODx Co-Founder
xPDO Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
  — Frank Herbert
Pages: [1] 2 3 ... 6   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!