Code Duplication    Length = 18-18 lines in 2 locations

core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 location

@@ 667-684 (lines=18) @@
664
        }
665
        // grab tables from each model
666
        $tables_to_check = array();
667
        foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
668
            if (method_exists($model_name, 'instance')) {
669
                $model_obj = call_user_func(array($model_name, 'instance'));
670
                if ($model_obj instanceof EEM_Base) {
671
                    foreach ($model_obj->get_tables() as $table) {
672
                        if (strpos($table->get_table_name(), 'esp_')
673
                            && (is_main_site()// for main tables, verify global tables
674
                                || ! $table->is_global()// if not the main site, then only verify non-global tables (avoid doubling up)
675
                            )
676
                            && function_exists('maybe_convert_table_to_utf8mb4')
677
                        ) {
678
                            $tables_to_check[] = $table->get_table_name();
679
                        }
680
                    }
681
                }
682
            }
683
        }
684
        // and let's just be sure these addons' tables get migrated too. They already get handled if their addons are active
685
        // when this code is run, but not otherwise. Once we record what tables EE added, we'll be able to use that instead
686
        // of hard-coding this
687
        $addon_tables = array(

core/helpers/EEH_Activation.helper.php 1 location

@@ 1492-1509 (lines=18) @@
1489
    {
1490
        $tables = array();
1491
        // load registry
1492
        foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1493
            if (method_exists($model_name, 'instance')) {
1494
                $model_obj = call_user_func(array($model_name, 'instance'));
1495
                if ($model_obj instanceof EEM_Base) {
1496
                    foreach ($model_obj->get_tables() as $table) {
1497
                        if (strpos($table->get_table_name(), 'esp_')
1498
                            &&
1499
                            (
1500
                                is_main_site()// main site? nuke them all
1501
                                || ! $table->is_global()// not main site,but not global either. nuke it
1502
                            )
1503
                        ) {
1504
                            $tables[ $table->get_table_name() ] = $table->get_table_name();
1505
                        }
1506
                    }
1507
                }
1508
            }
1509
        }
1510
1511
        // there are some tables whose models were removed.
1512
        // they should be removed when removing all EE core's data