Add update_existing_records static to disable modifying existing records

This commit is contained in:
John Milmine 2014-07-21 16:38:22 +12:00 committed by Will Rossiter
parent 7342850139
commit bf60ac4fdc

View File

@ -213,6 +213,13 @@ class Translatable extends DataExtension implements PermissionProvider {
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
*/
static function reset() {
@ -681,7 +688,7 @@ class Translatable extends DataExtension implements PermissionProvider {
// Only add the code if no more restrictive code exists
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
// created in the database, make sure to update the Locale property if
// if wasn't set before
@ -726,6 +733,7 @@ class Translatable extends DataExtension implements PermissionProvider {
$this->owner->class
));
}
}
/**
* Add a record to a "translation group",