PHPackages                             tractorcow/silverstripe-legacyimport - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tractorcow/silverstripe-legacyimport

ActiveSilverstripe-module

tractorcow/silverstripe-legacyimport
====================================

Import old 2.4 sites into 3.1

31841[3 issues](https://github.com/tractorcow/silverstripe-legacyimport/issues)[1 PRs](https://github.com/tractorcow/silverstripe-legacyimport/pulls)PHP

Since Apr 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tractorcow/silverstripe-legacyimport)[ Packagist](https://packagist.org/packages/tractorcow/silverstripe-legacyimport)[ RSS](/packages/tractorcow-silverstripe-legacyimport/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Legacy Importer
===============

[](#legacy-importer)

Import your 2.x sites into 3.x!

Setting up DB credentials
-------------------------

[](#setting-up-db-credentials)

You'll need to set the following in your `_ss_environment.php` file to point to the old site's database:

- SS\_REMOTE\_DATABASE\_SERVER
- SS\_REMOTE\_DATABASE\_USERNAME
- SS\_REMOTE\_DATABASE\_PASSWORD
- SS\_REMOTE\_DATABASE\_NAME
- SS\_REMOTE\_DATABASE\_CLASS (optional, defaults to MySQLDatabase)
- SS\_REMOTE\_DATABASE\_PORT (optional)
- SS\_REMOTE\_DATABASE\_SCHEMA (optional)
- SS\_REMOTE\_DATABASE\_TIMEZONE (optional)
- SS\_REMOTE\_DATABASE\_PATH (optional)

Running the importer
--------------------

[](#running-the-importer)

You can run this as a dev task using the following

`./framework/sake dev/tasks/LegacyImportTask flush=all`

The import itself is made up of several steps, with each step focusing on importing a single object type.

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:

```
---
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

- identify groups
- identify pages
- identify members
- import pages (add or update)
- import members (only add new ones)
- link page relations
- link member relations

Running task groups
-------------------

[](#running-task-groups)

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.

```
---
Name: mylegacyimport
---
LegacyImportTask:
  fixpermissions:
    - importer: DataObjectImporter
      class: Group
      strategy:
        - Update
```

This could be run with the following command.

`./framework/sake dev/tasks/LegacyImportTask flush=all tasks=fixpermissions`

Running just a single pass
--------------------------

[](#running-just-a-single-pass)

If you want to run a single pass you can skip to one using the 'pass' param.

`./framework/sake dev/tasks/LegacyImportTask flush=all pass=identify`

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.

The passes are as follows:

### identify

[](#identify)

Remote objects are selected and compared to all local objects used specified criterea. Then a mapping of all identified objects is created.

### import

[](#import)

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.

### link

[](#link)

A final check-all objects task is run to hook up many\_many relations and any other outstanding has\_ones.

Importers
---------

[](#importers)

These are the following importers and their supported strategies:

### DataObjectImporter

[](#dataobjectimporter)

This is the basic importer, and can import just about any object.

You can use one or more of the following strategies:

- Add - New objects which don't exist locally are added. If doing Add without Identify, then you don't need to use idcolumns, since no comparisons will be made.
- Identify - Determine any mapping between local and remote objects. This pass will use the 'idcolumns' config to identify matches between objects. Note that if you use relations (E.g. ParentID) then be careful where objects might have different IDs across databases. This is ok if using ParentID = 0 as a filter.
- Update - If a record is found it is updated. Will not work by itself, since it either needs Identify or Add in either the same, or a prior task. If used with Identify it will update all matching records. If used with Add it will update all records which were originally added, but were changed since the last import.

### AssetImporter

[](#assetimporter)

This importer loads assets into your site, and has only two specific strategies.

#### Preload

[](#preload)

All assets will be downloaded to the local server under a temporary directory prior to synchronisation

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.

rsync command (preferred)

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

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

```
define('SS_REMOTE_SYNC_STORE', '/sites/mynewsite/importedfiles/assets');
```

#### OnDemand

[](#ondemand)

Files will be downloaded as needed. You must define a remote site root to determine this.

```
define('SS_REMOTE_SITE', 'http://www.myoldsite.com');
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6a363b2d85dc3e82e73cc9e3a57fc15132920b166c5938ad63a54029b9f94b9?d=identicon)[tractorcow](/maintainers/tractorcow)

---

Top Contributors

[![halkyon](https://avatars.githubusercontent.com/u/138450?v=4)](https://github.com/halkyon "halkyon (1 commits)")

### Embed Badge

![Health badge](/badges/tractorcow-silverstripe-legacyimport/health.svg)

```
[![Health](https://phpackages.com/badges/tractorcow-silverstripe-legacyimport/health.svg)](https://phpackages.com/packages/tractorcow-silverstripe-legacyimport)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
