Version: current

# Class MigrateTranslatableTask

Migrates the old Translatable datamodel introduced in SilverStripe 2.1 to the new schema introduced in SilverStripe 2.3.2. Just works for `SiteTree` records and subclasses. If you have used the Translatable extension on other `DataObject` subclasses before, this script won't migrate them automatically.

## Limitations

- Information from the `Versioned` extension (e.g. in "SiteTree_versions" table) will be discarded for translated records.
- Custom translatable fields on your own `Page` class or subclasses thereof won't be migrated into the translation.
- 2.1-style subtags of a language (e.g. "en") will be automatically disambiguated to their full locale value (e.g. "en_US"), by the lookup defined in `i18n::get_locale_from_lang()`.
- Doesn't detect published translations when the script is run twice on the same data set

## Usage

PLEASE BACK UP YOUR DATABASE BEFORE RUNNING THIS SCRIPT.

Warning: Please run dev/build on your 2.2 database to update the schema before running this task. The dev/build command will rename tables like "SiteTree_lang" to "_obsolete_SiteTree_lang".

### Commandline

Requires "sake" tool (see http://doc.silverstripe.com/?id=sake) <example> sake dev/tasks/MigrateTranslatableTask </example>

### Browser

<example> http://mydomain.com/dev/tasks/MigrateTranslatableTask </example>

  Object
  BuildTask
  MigrateTranslatableTask

Package: sapphire\tasks
Located at sapphire/tasks/MigrateTranslatableTask.php

## Methods summary

`public` | # `init( )`
`public` | # `run( mixed $request )` Implement this method in the task subclass to execute via the TaskRunner Implement this method in the task subclass to execute via the TaskRunner

### Methods inherited from BuildTask

`getDescription()`, `getTitle()`, `isEnabled()`

### Methods inherited from Object

`__call()`, `__construct()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `defineMethods()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`protected string` | $title | # $title Shown in the overview on the `TaskRunner` HTML or CLI interface. Should be short and concise, no HTML allowed. $title Shown in the overview on the `TaskRunner` HTML or CLI interface. Should be short and concise, no HTML allowed.
`protected string` | $description | # $description Describe the implications the task has, and the changes it makes. Accepts HTML formatting. $description Describe the implications the task has, and the changes it makes. Accepts HTML formatting.

### Properties inherited from BuildTask

`$enabled`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -