Code Duplication    Length = 16-16 lines in 2 locations

code/DataIntegrityMoveFieldUpOrDownClassHierarchy.php 1 location

@@ 274-289 (lines=16) @@
271
            DB::alteration_message("tried to delete $table.$field but CLASS does not exist", "deleted");
272
            return false;
273
        }
274
        if (!in_array($field, $fields)) {
275
            DB::alteration_message("tried to delete $table.$field but FIELD does not exist", "deleted");
276
            return false;
277
        } else {
278
            DB::alteration_message("Deleting $field in $table", "deleted");
279
            DB::query('ALTER TABLE "'.$table.'" DROP "'.$field.'";');
280
            $obj = singleton($table);
281
            //to do: make this more reliable - checking for versioning rather than SiteTree
282
            if ($obj instanceof SiteTree) {
283
                DB::query('ALTER TABLE "'.$table.'_Live" DROP "'.$field.'";');
284
                DB::alteration_message("Deleted $field in {$table}_Live", "deleted");
285
                DB::query('ALTER TABLE "'.$table.'_versions" DROP "'.$field.'";');
286
                DB::alteration_message("Deleted $field in {$table}_versions", "deleted");
287
            }
288
            return true;
289
        }
290
    }
291
}
292

code/DataIntegrityTest.php 1 location

@@ 386-401 (lines=16) @@
383
            DB::alteration_message("tried to delete $table.$field but CLASS does not exist", "deleted");
384
            return false;
385
        }
386
        if (!in_array($field, $fields)) {
387
            DB::alteration_message("tried to delete $table.$field but FIELD does not exist", "deleted");
388
            return false;
389
        } else {
390
            DB::alteration_message("Deleting $field in $table", "deleted");
391
            DB::query('ALTER TABLE "'.$table.'" DROP "'.$field.'";');
392
            $obj = singleton($table);
393
            //to do: make this more reliable - checking for versioning rather than SiteTree
394
            if ($obj instanceof SiteTree) {
395
                DB::query('ALTER TABLE "'.$table.'_Live" DROP "'.$field.'";');
396
                DB::alteration_message("Deleted $field in {$table}_Live", "deleted");
397
                DB::query('ALTER TABLE "'.$table.'_versions" DROP "'.$field.'";');
398
                DB::alteration_message("Deleted $field in {$table}_versions", "deleted");
399
            }
400
            return true;
401
        }
402
    }
403
404
    private function swapArray($array)