mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Fixed db/build comparison for enum values
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@67076 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
24ba880d11
commit
3a13be7703
@ -334,14 +334,12 @@ abstract class Database extends Object {
|
||||
// Update any records where the enum is set to a legacy value to be set to the default.
|
||||
// One hard-coded exception is SiteTree - the default for this is Page.
|
||||
if(substr($spec, 0, 4) == "enum") {
|
||||
$new = substr($spec, 5);
|
||||
$old = substr($this->fieldList[$table][$field], 5);
|
||||
$new = substr($new, 0, strpos($new, ')'));
|
||||
$old = substr($old, 0, strpos($old, ')'));
|
||||
$new = str_replace("'", '', $new);
|
||||
$old = str_replace("'", '', $old);
|
||||
$new = explode(',', $new);
|
||||
$old = explode(',', $old);
|
||||
$newStr = preg_replace("/(^enum\s*\(')|('$\).*)/i","",$spec);
|
||||
$new = preg_split("/'\s*,\s*'/", $newStr);
|
||||
|
||||
$oldStr = preg_replace("/(^enum\s*\(')|('$\).*)/i","",$this->fieldList[$table][$field]);
|
||||
$old = preg_split("/'\s*,\s*'/", $newStr);
|
||||
|
||||
$holder = array();
|
||||
foreach($old as $check) {
|
||||
if(!in_array($check, $new)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user