mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 09:05:59 +00:00
Add update_existing_records static to disable modifying existing records
This commit is contained in:
parent
7342850139
commit
bf60ac4fdc
@ -213,6 +213,13 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
private static $enforce_global_unique_urls = true;
|
private static $enforce_global_unique_urls = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @var boolean on dev/build, update any records that don't have a Locale
|
||||||
|
* set. Note: This will use a write and a publish, effectively modifying the
|
||||||
|
* records.
|
||||||
|
*/
|
||||||
|
private static $update_existing_records = true;
|
||||||
|
|
||||||
|
/*
|
||||||
* Reset static configuration variables to their default values
|
* Reset static configuration variables to their default values
|
||||||
*/
|
*/
|
||||||
static function reset() {
|
static function reset() {
|
||||||
@ -681,7 +688,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
// Only add the code if no more restrictive code exists
|
// Only add the code if no more restrictive code exists
|
||||||
if(!$hasTranslationCode) Permission::grant($group->ID, 'TRANSLATE_ALL');
|
if(!$hasTranslationCode) Permission::grant($group->ID, 'TRANSLATE_ALL');
|
||||||
}
|
}
|
||||||
|
if(Config::inst()->get('Translatable', 'update_existing_records')) {
|
||||||
// If the Translatable extension was added after the first records were already
|
// If the Translatable extension was added after the first records were already
|
||||||
// created in the database, make sure to update the Locale property if
|
// created in the database, make sure to update the Locale property if
|
||||||
// if wasn't set before
|
// if wasn't set before
|
||||||
@ -726,6 +733,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
$this->owner->class
|
$this->owner->class
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a record to a "translation group",
|
* Add a record to a "translation group",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user