Code Duplication    Length = 18-20 lines in 2 locations

Bootstrap/Update.php 2 locations

@@ 423-440 (lines=18) @@
420
    /**
421
     * Create most used indexes in s_plugin_connect_items table.
422
     */
423
    private function addConnectItemsIndex()
424
    {
425
        if (version_compare($this->version, '1.1.1', '<=')) {
426
            try {
427
                $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX stream(shop_id, stream)');
428
                $this->db->query('ALTER TABLE s_plugin_connect_items MODIFY group_id VARCHAR(64)');
429
                $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX source_id (source_id, shop_id)');
430
                $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX group_id (group_id, shop_id)');
431
            } catch (\Exception $e) {
432
                // ignore it if exists
433
                $this->logger->write(
434
                    true,
435
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
436
                    $e->getMessage()
437
                );
438
            }
439
        }
440
    }
441
442
    /**
443
     * Create the mapping table between connect remote categories and local categories.
@@ 536-555 (lines=20) @@
533
        }
534
    }
535
536
    private function addShopIdToConnectCategories()
537
    {
538
        if (version_compare($this->version, '1.1.7', '<=')) {
539
            try {
540
                if (!$this->existsConfig('addShopIdToConnectCategories')) {
541
                    $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`) VALUES ("addShopIdToConnectCategories", "0")');
542
                }
543
                $this->db->query('ALTER TABLE s_plugin_connect_categories ADD COLUMN `shop_id` int(11) NULL');
544
                $this->db->query('ALTER TABLE s_plugin_connect_categories DROP INDEX scuk_category_key');
545
                $this->db->query('ALTER TABLE s_plugin_connect_categories ADD UNIQUE KEY `scuk_connect_category_for_shop_id` (`category_key`,`shop_id`)');
546
            } catch (\Exception $e) {
547
                // ignore it if exists
548
                $this->logger->write(
549
                    true,
550
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
551
                    $e->getMessage()
552
                );
553
            }
554
        }
555
    }
556
557
    private function addStreamColumnToConnectToLocalCategories()
558
    {