Code Duplication    Length = 15-25 lines in 4 locations

Bootstrap/Update.php 4 locations

@@ 491-505 (lines=15) @@
488
        }
489
    }
490
491
    private function setDefaultConfigForUpdateOrderStatus()
492
    {
493
        if (version_compare($this->version, '1.1.7', '<=')) {
494
            try {
495
                $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("updateOrderStatus", "0", "import")');
496
            } catch (\Exception $e) {
497
                // ignore it if exists
498
                $this->logger->write(
499
                    true,
500
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
501
                    $e->getMessage()
502
                );
503
            }
504
        }
505
    }
506
507
  /**
508
     * Create index by articleID in s_plugin_connect_product_to_categories table.
@@ 475-489 (lines=15) @@
472
        }
473
    }
474
475
    private function recreateRemoteCategoriesAndProductAssignments()
476
    {
477
        if (version_compare($this->version, '1.1.4', '<=')) {
478
            try {
479
                $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`) VALUES ("recreateConnectCategories", "0")');
480
            } catch (\Exception $e) {
481
                // ignore it if exists
482
                $this->logger->write(
483
                    true,
484
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
485
                    $e->getMessage()
486
                );
487
            }
488
        }
489
    }
490
491
    private function setDefaultConfigForUpdateOrderStatus()
492
    {
@@ 510-524 (lines=15) @@
507
  /**
508
     * Create index by articleID in s_plugin_connect_product_to_categories table.
509
     */
510
    private function addProductToCategoryIndex()
511
    {
512
        if (version_compare($this->version, '1.1.7', '<=')) {
513
            try {
514
                $this->db->query('ALTER TABLE s_plugin_connect_product_to_categories ADD INDEX article_id(articleID)');
515
            } catch (\Exception $e) {
516
                // ignore it if exists
517
                $this->logger->write(
518
                    true,
519
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
520
                    $e->getMessage()
521
                );
522
            }
523
        }
524
    }
525
526
    private function addShopIdToConnectCategories()
527
    {
@@ 545-569 (lines=25) @@
542
        }
543
    }
544
545
    private function addArticleRelationsTable()
546
    {
547
        if (version_compare($this->version, '1.1.8', '<=')) {
548
            try {
549
                $this->db->query('CREATE TABLE IF NOT EXISTS `s_plugin_connect_article_relations` (
550
                  `id` int(11) NOT NULL AUTO_INCREMENT,
551
                  `article_id` int(11) unsigned NOT NULL,
552
                  `shop_id` int(11) NOT NULL,
553
                  `related_article_local_id` int(11) NOT NULL,
554
                  `relationship_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
555
                  PRIMARY KEY (`id`),
556
                  UNIQUE KEY `relations` (`article_id`, `shop_id`, `related_article_local_id`, `relationship_type`),
557
                  CONSTRAINT s_plugin_connect_article_relations_fk_article_id FOREIGN KEY (article_id) REFERENCES s_articles (id) ON DELETE CASCADE
558
                  ) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;'
559
                );
560
            } catch (\Exception $e) {
561
                // ignore it if exists
562
                $this->logger->write(
563
                    true,
564
                    sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()),
565
                    $e->getMessage()
566
                );
567
            }
568
        }
569
    }
570
}
571