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