Jump to content

Merge existing data with a new profile-based site?


SteveB
 Share

Recommended Posts

I have a vanilla 2.3.0 PW site where I've created an early demo of a project. It would be great to have my demo on a PW installation with the Blog Profile so I can use that as a project blog, get comments from potential users, collaborators etc.

Is there a way to create a new bloggy PW installation and migrate my Templates, Fields, Pages, etc. to it?

Is there a way to graft the Blog Profile onto to my existing PW installtion without wiping out or breaking my project?

My demo is only about 20 PW pages, a few files, and whatever data that has created. I could setup a new installation with Blog Profile and manually reconstruct my demo. I guess I could write a csv export tool for my pages, then setup templates, fields, etc. in the admin, move files around and use the csv import tool.

I can imagine this kind of thing coming up in the future with big content though and I'm hoping to learn what my options are. I do remember seeing a thread pondering how to update a live site from a dev version which had started as a clone of the live site. Are there tools and practices to help with moving part of one site into another?

Thanks

Link to comment
Share on other sites

Haven't really thought this through but I think I would go with installing the Blog Profile first. I would then move the Blog pages (blog posts, categories, tags, etc) to a new parent page under Home, e.g. Blog. I would then copy over the template files manually. I would recreate the demo site using PW API rather than manually - i.e. use the API to create templates, fields and pages. I don't have know how much data you have in your pages' fields  but your options include doing that in phpMyAdmin, for instance. 

Link to comment
Share on other sites

I think the key thing is to use the API to recreate templates, fields and pages. Direct data transfer is okay for a whole site but will break things if done piecemeal (clashes of ids etc). One could come up with tool and for a semi automated process like...

Start at the top of a tree of pages

Run through it looking for templates

Run through those looking for Fields

Check that the necessary fields and templates can be made on the destination system or are there and seem identical.

- manual intervention -

Setup Fields

Setup Templates

Run through the pages

- some intervention and cleanup may be needed -

PW maintains a unique index between the page name and the parent_id and adds a number to the end to (smith, smith1, smith2...). Page ids and possibly names may end up different than they were on the source system. This might require attention depending on the situation but seems unlikely to be a big problem.

For my current situation it makes sense to setup the templates and fields by hand. The pages are under a couple of root parent pages so they are not going to clash with anything. Still this seems like the kind of thing where having a strategy in place for "partial migration" could payoff later.

  • Like 1
Link to comment
Share on other sites

That could be useful but for now, I'll setup fields and templates by hand (not enough to bother with automation). Then migrate the items from system A to system B with help from existing modules. Do it by installing Pages Web Service on system A, Calling that from a script which takes the json info and write out a csv file representing the items. Then on system B using Import Pages from CSV files to create the pages from that csv. I have to stop now but I'll report back.

  • Like 1
Link to comment
Share on other sites

The method for migrating pages mostly worked. FYI, the bit of code in the middle to make the CSV file needs to use html_entity_decode on the conent it gets from Pages Web Service. I'm putting this together on my Win7 desktop and the only real problem I had may be Win related; the import from CSV complained it could not copy the images into the newly created item's asset folder. The paths were right. Afterwards I used the admin pages to add those images and that was fine. That may fix itself when I move it to a real server (Linux).

The next gotcha was that I forgot that having $options passed along through recursive rendering only works with Dev version of PW. With that sorted out, my demo is inside a pretty much standard Blog Profile site. I modified the home page to have fixed content in the middle instead of recent posts. I tested using the blog system's category navigation within my demo and that works nicely. A good thing since integration with CMS is one of the project's features. The demo has its own bare-bones templates and CSS so as not to get too carried away. Initial purpose is to sound out my clients about the more functional and structural features.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...