| @@ 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 | { |
|
| @@ 547-563 (lines=17) @@ | ||
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| 547 | private function changeExportStatusToVarchar() |
|
| 548 | { |
|
| 549 | if (version_compare($this->version, '1.1.8', '<=')) { |
|
| 550 | try { |
|
| 551 | $this->db->query('ALTER TABLE s_plugin_connect_items MODIFY export_status varchar(255)'); |
|
| 552 | $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX IDX_revision (revision)'); |
|
| 553 | $this->db->query('ALTER TABLE s_plugin_connect_items ADD INDEX IDX_status (export_status)'); |
|
| 554 | } catch (\Exception $e) { |
|
| 555 | // ignore it if exists |
|
| 556 | $this->logger->write( |
|
| 557 | true, |
|
| 558 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 559 | $e->getMessage() |
|
| 560 | ); |
|
| 561 | } |
|
| 562 | } |
|
| 563 | } |
|
| 564 | ||
| 565 | private function addArticleRelationsTable() |
|
| 566 | { |
|
| @@ 565-589 (lines=25) @@ | ||
| 562 | } |
|
| 563 | } |
|
| 564 | ||
| 565 | private function addArticleRelationsTable() |
|
| 566 | { |
|
| 567 | if (version_compare($this->version, '1.1.8', '<=')) { |
|
| 568 | try { |
|
| 569 | $this->db->query('CREATE TABLE IF NOT EXISTS `s_plugin_connect_article_relations` ( |
|
| 570 | `id` int(11) NOT NULL AUTO_INCREMENT, |
|
| 571 | `article_id` int(11) unsigned NOT NULL, |
|
| 572 | `shop_id` int(11) NOT NULL, |
|
| 573 | `related_article_local_id` int(11) NOT NULL, |
|
| 574 | `relationship_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, |
|
| 575 | PRIMARY KEY (`id`), |
|
| 576 | UNIQUE KEY `relations` (`article_id`, `shop_id`, `related_article_local_id`, `relationship_type`), |
|
| 577 | CONSTRAINT s_plugin_connect_article_relations_fk_article_id FOREIGN KEY (article_id) REFERENCES s_articles (id) ON DELETE CASCADE |
|
| 578 | ) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;' |
|
| 579 | ); |
|
| 580 | } catch (\Exception $e) { |
|
| 581 | // ignore it if exists |
|
| 582 | $this->logger->write( |
|
| 583 | true, |
|
| 584 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 585 | $e->getMessage() |
|
| 586 | ); |
|
| 587 | } |
|
| 588 | } |
|
| 589 | } |
|
| 590 | ||
| 591 | private function addOverwriteMainImage() |
|
| 592 | { |
|
| @@ 591-606 (lines=16) @@ | ||
| 588 | } |
|
| 589 | } |
|
| 590 | ||
| 591 | private function addOverwriteMainImage() |
|
| 592 | { |
|
| 593 | if (version_compare($this->version, '1.1.8', '<=')) { |
|
| 594 | try { |
|
| 595 | $this->db->query('INSERT INTO `s_plugin_connect_config` (`name`, `value`, `groupName`) VALUES ("overwriteProductMainImage", "1", "import")'); |
|
| 596 | $this->db->query('ALTER TABLE `s_plugin_connect_items` ADD COLUMN `update_main_image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL'); |
|
| 597 | } catch (\Exception $e) { |
|
| 598 | // ignore it if exists |
|
| 599 | $this->logger->write( |
|
| 600 | true, |
|
| 601 | sprintf('An error occurred during update to version %s stacktrace: %s', $this->version, $e->getTraceAsString()), |
|
| 602 | $e->getMessage() |
|
| 603 | ); |
|
| 604 | } |
|
| 605 | } |
|
| 606 | } |
|
| 607 | } |
|
| 608 | ||