dev-master
9999999-devImport old 2.4 sites into 3.1
BSD-3-Clause
The Requires
silverstripe import migrate
Wallogit.com
2017 © Pedro Peláez
Import old 2.4 sites into 3.1
Import your 2.x sites into 3.x!, (*1)
You'll need to set the following in your _ss_environment.php file to point to the old site's database:, (*2)
You can run this as a dev task using the following, (*3)
./framework/sake dev/tasks/LegacyImportTask flush=all, (*4)
The import itself is made up of several steps, with each step focusing on importing a single object type., (*5)
The actual import itself is broken down into several passes, within each pass a different method on each step is invoked. For example if your import configuration looks like the below:, (*6)
---
Name: mylegacyimport
---
LegacyImportTask:
tasks:
- importer: DataObjectImporter
class: Group
# Don't update groups, but identify links
strategy:
- Identify
# Identify matching groups by code
idcolumns:
- Code
- importer: SiteTreeImporter
# Just import top level pages, but don't try to update pages with existing url segments
strategy:
- Add
- Update
class: ForumHolder
where:
- '"ParentID" = 0'
- importer: DataObjectImporter
class: Member
strategy:
- Add
- Identify
idcolumns:
- Email
The actual process will perform the following tasks, (*7)
If you want to setup different groups of tasks to run, just replace the 'tasks' in the config with
another key and use the tasks=mytasks querystring parameter instead., (*8)
---
Name: mylegacyimport
---
LegacyImportTask:
fixpermissions:
- importer: DataObjectImporter
class: Group
strategy:
- Update
This could be run with the following command., (*9)
./framework/sake dev/tasks/LegacyImportTask flush=all tasks=fixpermissions, (*10)
If you want to run a single pass you can skip to one using the 'pass' param., (*11)
./framework/sake dev/tasks/LegacyImportTask flush=all pass=identify, (*12)
Warning: Some steps may rely on identification being performed up front, and you should not begin an import at a later step if prior steps have not been completed., (*13)
The passes are as follows:, (*14)
Remote objects are selected and compared to all local objects used specified criterea. Then a mapping of all identified objects is created., (*15)
All objects are created (as allowed) or updated (as allowed). Some relations will be hooked up (has_one) as long as all necessary related objects are available, and have been identified in prior tasks., (*16)
A final check-all objects task is run to hook up many_many relations and any other outstanding has_ones., (*17)
These are the following importers and their supported strategies:, (*18)
This is the basic importer, and can import just about any object., (*19)
You can use one or more of the following strategies:, (*20)
This importer loads assets into your site, and has only two specific strategies., (*21)
All assets will be downloaded to the local server under a temporary directory prior to synchronisation, (*22)
For asset transfers also please specify the appropriate rsync or scp command to use. You will also need to set a holding directory for downloaded assets, which should be outside of your webroot., (*23)
rsync command (preferred), (*24)
define(
'SS_REMOTE_SYNC_COMMAND',
'rsync -rz -e \'ssh -p 2222\' --progress someuser@192.168.0.54:/sites/myoldsite/www/assets /sites/mynewsite/importedfiles'
);
scp command (if rsync is not available), (*25)
define(
'SS_REMOTE_SYNC_COMMAND',
'scp -rP 2222 someuser@192.168.0.54:/sites/myoldsite/www/assets /sites/mynewsite/importedfiles'
);
Specify location of assets directory once the above command has executed., (*26)
define('SS_REMOTE_SYNC_STORE', '/sites/mynewsite/importedfiles/assets');
Files will be downloaded as needed. You must define a remote site root to determine this., (*27)
define('SS_REMOTE_SITE', 'http://www.myoldsite.com');
Import old 2.4 sites into 3.1
BSD-3-Clause
silverstripe import migrate