mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Fix translatable migration regenerating URLSegments when it shouldn't
BUGFIX: Fix translatable migration not writing records to Live properly git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@70080 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
aca51f68bc
commit
4f42548da6
@ -13,6 +13,8 @@ class MigrateTranslatableTask extends BuildTask {
|
||||
function run($request) {
|
||||
$ids = array();
|
||||
|
||||
//$_REQUEST['showqueries'] = 1;
|
||||
|
||||
foreach(array('Stage', 'Live') as $stage) {
|
||||
echo "<h2>Migrating stage $stage</h2>";
|
||||
echo "<ul>";
|
||||
@ -29,7 +31,7 @@ class MigrateTranslatableTask extends BuildTask {
|
||||
|
||||
// Get the untranslated page
|
||||
$original = Versioned::get_one_by_stage($oldtrans['ClassName'], $stage, '`SiteTree`.ID = ' . $oldtrans['OriginalLangID']);
|
||||
|
||||
|
||||
// Clone the original, and set it up as a translation
|
||||
$newtrans = $original->duplicate(false);
|
||||
$newtrans->OriginalID = $original->ID;
|
||||
@ -57,9 +59,13 @@ class MigrateTranslatableTask extends BuildTask {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Write the new translation to the database
|
||||
$newtrans->writeToStage($stage);
|
||||
$sitelang = Translatable::current_lang();
|
||||
Translatable::set_reading_lang($newtrans->Lang);
|
||||
$newtrans->writeToStage($stage, true);
|
||||
Translatable::set_reading_lang($sitelang);
|
||||
|
||||
if($stage == 'Stage') {
|
||||
$ids[$original->ID] = $newtrans->ID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user