From a397b80640b5d663a8ecb0f92cb021bbd0db7978 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Tue, 23 Jan 2018 14:03:23 -0600 Subject: [PATCH] Fixed regression: db_verify distinguish results Regression in #2999 prevents db_verify from distinguishing fields from indices This prevents database migrations where both the fields and the indices of a field need to be updated in one migration. This commit fixes that. Fixes: #3001 --- e107_handlers/db_verify_class.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/e107_handlers/db_verify_class.php b/e107_handlers/db_verify_class.php index ae49653ef..a90a8cb3a 100644 --- a/e107_handlers/db_verify_class.php +++ b/e107_handlers/db_verify_class.php @@ -356,9 +356,11 @@ class db_verify // Check field and index data foreach(['field', 'index'] as $type) { + $results = 'results'; + if ($type === 'index') $results = 'indices'; foreach($fileData[$type] as $key => $value) { - $this->results[$tbl][$key]['_status'] = 'ok'; + $this->{$results}[$tbl][$key]['_status'] = 'ok'; //print("EXPECTED"); //print_a($value); @@ -368,18 +370,18 @@ class db_verify if(!is_array($sqlData[$type][$key])) { $this->errors[$tbl]['_status'] = 'error'; // table status - $this->results[$tbl][$key]['_status'] = "missing_$type"; // type status - $this->results[$tbl][$key]['_valid'] = $value; - $this->results[$tbl][$key]['_file'] = $selection; + $this->{$results}[$tbl][$key]['_status'] = "missing_$type"; // type status + $this->{$results}[$tbl][$key]['_valid'] = $value; + $this->{$results}[$tbl][$key]['_file'] = $selection; } elseif(count($diff = $this->diffStructurePermissive($value, $sqlData[$type][$key]))) { $this->errors[$tbl]['_status'] = "mismatch_$type"; - $this->results[$tbl][$key]['_status'] = 'mismatch'; - $this->results[$tbl][$key]['_diff'] = $diff; - $this->results[$tbl][$key]['_valid'] = $value; - $this->results[$tbl][$key]['_invalid'] = $sqlData[$type][$key]; - $this->results[$tbl][$key]['_file'] = $selection; + $this->{$results}[$tbl][$key]['_status'] = 'mismatch'; + $this->{$results}[$tbl][$key]['_diff'] = $diff; + $this->{$results}[$tbl][$key]['_valid'] = $value; + $this->{$results}[$tbl][$key]['_invalid'] = $sqlData[$type][$key]; + $this->{$results}[$tbl][$key]['_file'] = $selection; } // TODO Check for additional fields in SQL that should be removed.