| @@ 477-491 (lines=15) @@ | ||
| 474 | } |
|
| 475 | } |
|
| 476 | ||
| 477 | private function recreateRemoteCategoriesAndProductAssignments() |
|
| 478 | { |
|
| 479 | if (version_compare($this->version, '1.1.4', '<=')) { |
|
| 480 | try { |
|
| 481 | $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`) VALUES ("recreateConnectCategories", "0")'); |
|
| 482 | } catch (\Exception $e) { |
|
| 483 | // ignore it if exists |
|
| 484 | $this->logger->write( |
|
| 485 | true, |
|
| 486 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 487 | $e->getMessage() |
|
| 488 | ); |
|
| 489 | } |
|
| 490 | } |
|
| 491 | } |
|
| 492 | ||
| 493 | private function setDefaultConfigForUpdateOrderStatus() |
|
| 494 | { |
|
| @@ 493-507 (lines=15) @@ | ||
| 490 | } |
|
| 491 | } |
|
| 492 | ||
| 493 | private function setDefaultConfigForUpdateOrderStatus() |
|
| 494 | { |
|
| 495 | if (version_compare($this->version, '1.1.7', '<=')) { |
|
| 496 | try { |
|
| 497 | $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("updateOrderStatus", "0", "import")'); |
|
| 498 | } catch (\Exception $e) { |
|
| 499 | // ignore it if exists |
|
| 500 | $this->logger->write( |
|
| 501 | true, |
|
| 502 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 503 | $e->getMessage() |
|
| 504 | ); |
|
| 505 | } |
|
| 506 | } |
|
| 507 | } |
|
| 508 | ||
| 509 | /** |
|
| 510 | * Create index by articleID in s_plugin_connect_product_to_categories table. |
|
| @@ 512-526 (lines=15) @@ | ||
| 509 | /** |
|
| 510 | * Create index by articleID in s_plugin_connect_product_to_categories table. |
|
| 511 | */ |
|
| 512 | private function addProductToCategoryIndex() |
|
| 513 | { |
|
| 514 | if (version_compare($this->version, '1.1.7', '<=')) { |
|
| 515 | try { |
|
| 516 | $this->db->query('ALTER TABLE s_plugin_connect_product_to_categories ADD INDEX article_id(articleID)'); |
|
| 517 | } catch (\Exception $e) { |
|
| 518 | // ignore it if exists |
|
| 519 | $this->logger->write( |
|
| 520 | true, |
|
| 521 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 522 | $e->getMessage() |
|
| 523 | ); |
|
| 524 | } |
|
| 525 | } |
|
| 526 | } |
|
| 527 | ||
| 528 | private function addShopIdToConnectCategories() |
|
| 529 | { |
|
| @@ 569-593 (lines=25) @@ | ||
| 566 | } |
|
| 567 | } |
|
| 568 | ||
| 569 | private function addArticleRelationsTable() |
|
| 570 | { |
|
| 571 | if (version_compare($this->version, '1.1.8', '<=')) { |
|
| 572 | try { |
|
| 573 | $this->db->query('CREATE TABLE IF NOT EXISTS `s_plugin_connect_article_relations` ( |
|
| 574 | `id` int(11) NOT NULL AUTO_INCREMENT, |
|
| 575 | `article_id` int(11) unsigned NOT NULL, |
|
| 576 | `shop_id` int(11) NOT NULL, |
|
| 577 | `related_article_local_id` int(11) NOT NULL, |
|
| 578 | `relationship_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, |
|
| 579 | PRIMARY KEY (`id`), |
|
| 580 | UNIQUE KEY `relations` (`article_id`, `shop_id`, `related_article_local_id`, `relationship_type`), |
|
| 581 | CONSTRAINT s_plugin_connect_article_relations_fk_article_id FOREIGN KEY (article_id) REFERENCES s_articles (id) ON DELETE CASCADE |
|
| 582 | ) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;' |
|
| 583 | ); |
|
| 584 | } catch (\Exception $e) { |
|
| 585 | // ignore it if exists |
|
| 586 | $this->logger->write( |
|
| 587 | true, |
|
| 588 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 589 | $e->getMessage() |
|
| 590 | ); |
|
| 591 | } |
|
| 592 | } |
|
| 593 | } |
|
| 594 | ||
| 595 | private function addOverwriteMainImage() |
|
| 596 | { |
|
| @@ 595-610 (lines=16) @@ | ||
| 592 | } |
|
| 593 | } |
|
| 594 | ||
| 595 | private function addOverwriteMainImage() |
|
| 596 | { |
|
| 597 | if (version_compare($this->version, '1.1.8', '<=')) { |
|
| 598 | try { |
|
| 599 | $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("overwriteProductMainImage", "1", "import")'); |
|
| 600 | $this->db->query('ALTER TABLE `s_plugin_connect_items` ADD COLUMN `update_main_image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL'); |
|
| 601 | } catch (\Exception $e) { |
|
| 602 | // ignore it if exists |
|
| 603 | $this->logger->write( |
|
| 604 | true, |
|
| 605 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 606 | $e->getMessage() |
|
| 607 | ); |
|
| 608 | } |
|
| 609 | } |
|
| 610 | } |
|
| 611 | } |
|
| 612 | ||