From 2da4187b59e312757aac66a70f1ebb9e9bc74205 Mon Sep 17 00:00:00 2001
From: webinmd <89poilo@gmail.com>
Date: Mon, 5 Jun 2023 00:07:10 +0300
Subject: [PATCH 01/19] Add ui for import
---
_build/data/transport.settings.php | 11 +
.../minishop2/js/mgr/utilites/import/panel.js | 212 ++++++++++++++++++
.../minishop2/js/mgr/utilites/panel.js | 4 +-
.../controllers/mgr/utilites.class.php | 5 +
.../minishop2/lexicon/ru/manager.inc.php | 14 ++
.../minishop2/lexicon/ru/setting.inc.php | 3 +
.../mgr/utilites/import/import.class.php | 86 +++++++
.../mgr/utilites/import/saveconfig.class.php | 63 ++++++
8 files changed, 395 insertions(+), 3 deletions(-)
create mode 100644 assets/components/minishop2/js/mgr/utilites/import/panel.js
create mode 100644 core/components/minishop2/processors/mgr/utilites/import/import.class.php
create mode 100644 core/components/minishop2/processors/mgr/utilites/import/saveconfig.class.php
diff --git a/_build/data/transport.settings.php b/_build/data/transport.settings.php
index 89a8749e0..1fb4196da 100644
--- a/_build/data/transport.settings.php
+++ b/_build/data/transport.settings.php
@@ -357,6 +357,17 @@
'value' => '2,3',
'xtype' => 'textfield',
'area' => 'ms2_statuses',
+ ],
+
+ 'ms2_utility_import_fields' => [
+ 'value' => 'article,pagetitle,price',
+ 'xtype' => 'textfield',
+ 'area' => 'ms2_import',
+ ],
+ 'ms2_utility_import_fields_delimiter' => [
+ 'value' => ';',
+ 'xtype' => 'textfield',
+ 'area' => 'ms2_import',
]
];
diff --git a/assets/components/minishop2/js/mgr/utilites/import/panel.js b/assets/components/minishop2/js/mgr/utilites/import/panel.js
new file mode 100644
index 000000000..2bc1554bb
--- /dev/null
+++ b/assets/components/minishop2/js/mgr/utilites/import/panel.js
@@ -0,0 +1,212 @@
+miniShop2.panel.UtilitesImport = function (config) {
+ config = config || {};
+
+ Ext.apply(config, {
+ cls: 'container form-with-labels',
+ autoHeight: true,
+ url: miniShop2.config.connector_url,
+ progress:true,
+ id: 'ms2-panel-import',
+ baseParams: {
+ action: 'mgr/utility/import/import'
+ },
+ items: [{
+ layout: 'column',
+ border: false,
+ anchor: '100%',
+ cls: 'main-wrapper',
+ labelAlign: 'top',
+ buttonAlign: 'left',
+ style: 'padding: 0 0 0 7px',
+ items: [{
+ columnWidth: 0.5,
+ layout: 'form',
+ defaults: { msgTarget: 'under' },
+ border: false,
+ style: { margin: '0' },
+ items: [
+ {
+ xtype: 'modx-combo-browser',
+ fieldLabel: _('ms2_utilites_import_label_file'),
+ emptyText: _('ms2_utilites_import_label_file_empty'),
+ anchor: '81%',
+ name: 'importfile',
+ allowBlank: false,
+ },
+ {
+ layout: 'column',
+ items:[{
+ columnWidth: 0.8,
+ layout: 'form',
+ border: false,
+ style: { margin: '0' },
+ items:[
+ {
+ xtype: 'textfield',
+ name: 'fields',
+ value: miniShop2.config.utility_import_fields,
+ width: '99%',
+ fieldLabel: _('ms2_utilites_import_label_fields'),
+ allowBlank: false,
+ },
+ {
+ xtype: 'textfield',
+ name: 'delimiter',
+ value: miniShop2.config.utility_import_fields_delimiter,
+ width: '99%',
+ allowBlank: false,
+ fieldLabel: _('ms2_utilites_import_label_delimiter'),
+ }
+ ]
+ },
+ {
+ columnWidth: 0.2,
+ layout: 'form',
+ border: false,
+ style: { margin: '20px 0 0 15px' },
+ items:[
+ {
+ xtype: 'button',
+ style: 'padding: 4px 10px 7px; margin: 18px 0 0 0',
+ tooltip: _('ms2_utilites_import_save_fields'),
+ text: '',
+ handler: function() {
+ this.saveConfig(this);
+ }, scope: this
+ }
+ ]
+
+ }]
+ },
+ {
+ xtype: 'xcheckbox',
+ name: 'update',
+ value: 1,
+ id: 'ms-utilites-import-update',
+ boxLabel: _('ms2_utilites_import_update_products'),
+ labelAlign: 'right',
+ listeners: {
+ check: {
+ fn : this.onUpdateNeed,
+ scope : this
+ },
+ }
+ },
+ {
+ xtype: 'textfield',
+ name: 'key',
+ value: 'article',
+ width: '99%',
+ hidden: true,
+ id: 'ms-utilites-import-key',
+ fieldLabel: _('ms2_utilites_import_update_key'),
+ },
+ {
+ xtype: 'xcheckbox',
+ name: 'debug',
+ value: 1,
+ hideLabel: true,
+ id: 'ms-utilites-import-debug',
+ boxLabel: _('ms2_utilites_import_debug'),
+ labelAlign: 'right',
+ },
+ {
+ xtype: 'xcheckbox',
+ name: 'scheduler',
+ value: 1,
+ hideLabel: true,
+ id: 'ms-utilites-import-scheduler',
+ boxLabel: _('ms2_utilites_import_use_scheduler'),
+ labelAlign: 'right',
+ },
+ {
+ xtype: 'button',
+ style: 'margin: 25px 0 0 2px',
+ text: ' '+_('ms2_utilites_import_submit'),
+ handler: function() {
+ this.submit(this);
+ }, scope: this
+ }
+ ]
+ }/*, {
+ columnWidth: 0.5,
+ layout: 'form',
+ defaults: { msgTarget: 'under' },
+ border: false,
+ style: { margin: '0 0 0 20px' },
+ items: [
+ {
+ xtype: 'fieldset',
+ title: 'Инструкция',
+ id: 'ms2-utilites-import-instruction',
+ cls: 'x-fieldset-checkbox-toggle',
+ style: 'margin: 5px 0 15px; padding: 20px; ',
+ collapsible: true,
+ collapsed: true,
+ stateful: true,
+ labelAlign: 'top',
+ stateEvents: ['collapse', 'expand'],
+ items: [
+ {
+ html: ''
+ },
+ ]
+ }
+ ]
+ }*/]
+ }] ,
+ listeners: {
+ success: {fn: function(response) {
+ var data = response.result.object;
+ MODx.msg.alert(_('info'), data.message);
+ },scope: this},
+ failure: {
+ fn:function(response) {
+ console.log(response);
+ },scope: this
+ }
+ }
+ });
+
+ miniShop2.panel.UtilitesImport.superclass.constructor.call(this, config);
+};
+
+Ext.extend(miniShop2.panel.UtilitesImport, MODx.FormPanel,{
+
+ onUpdateNeed: function (cb) {
+ var updateKey = Ext.getCmp('ms-utilites-import-key');
+ if (cb.getValue()) {
+ updateKey.show();
+ } else {
+ updateKey.hide();
+ }
+ },
+
+ saveConfig: function () {
+ var form = this.getForm();
+ var values = form.getValues();
+
+ MODx.Ajax.request({
+ url: miniShop2.config['connector_url'],
+ params: {
+ action: 'mgr/utility/import/saveconfig',
+ fields: values.fields,
+ delimiter: values.delimiter
+ },
+ listeners: {
+ success: {
+ fn: function (r) {
+ MODx.msg.status({
+ title: _('ms2_utilites_import_save_fields_title'),
+ message: _('ms2_utilites_import_save_fields_message'),
+ delay: 7
+ });
+ }, scope: this
+ }
+ }
+ });
+
+ }
+
+});
+Ext.reg('minishop2-utilites-import', miniShop2.panel.UtilitesImport);
diff --git a/assets/components/minishop2/js/mgr/utilites/panel.js b/assets/components/minishop2/js/mgr/utilites/panel.js
index 8c13cd0c0..2ba3831c9 100644
--- a/assets/components/minishop2/js/mgr/utilites/panel.js
+++ b/assets/components/minishop2/js/mgr/utilites/panel.js
@@ -28,8 +28,6 @@ miniShop2.panel.Utilites = function (config) {
cls: 'main-wrapper',
}]
},
- /*
- // todo
{
title: _('ms2_utilites_import'),
layout: 'anchor',
@@ -40,7 +38,7 @@ miniShop2.panel.Utilites = function (config) {
xtype: 'minishop2-utilites-import',
cls: 'main-wrapper',
}]
- }*/
+ }
]
}]
diff --git a/core/components/minishop2/controllers/mgr/utilites.class.php b/core/components/minishop2/controllers/mgr/utilites.class.php
index e6c6c1ef9..c33fb746a 100644
--- a/core/components/minishop2/controllers/mgr/utilites.class.php
+++ b/core/components/minishop2/controllers/mgr/utilites.class.php
@@ -33,6 +33,7 @@ public function loadCustomCssJs()
$this->addJavascript($this->miniShop2->config['jsUrl'] . 'mgr/minishop2.js');
$this->addJavascript($this->miniShop2->config['jsUrl'] . 'mgr/utilites/panel.js');
$this->addJavascript($this->miniShop2->config['jsUrl'] . 'mgr/utilites/gallery/panel.js');
+ $this->addJavascript($this->miniShop2->config['jsUrl'] . 'mgr/utilites/import/panel.js');
$config = $this->miniShop2->config;
@@ -54,6 +55,10 @@ public function loadCustomCssJs()
$config['utility_gallery_total_products'] = $this->modx->getCount('msProduct', ['class_key' => 'msProduct']);
$config['utility_gallery_total_products_files'] = $this->modx->getCount('msProductFile', ['parent' => 0]);
+ // get params for import
+ $config['utility_import_fields'] = $this->getOption('ms2_utility_import_fields', null, 'article,pagetitle,price', true);
+ $config['utility_import_fields_delimiter'] = $this->getOption('ms2_utility_import_fields_delimiter', null, ';', true);
+
$this->addHtml(
''
);
diff --git a/core/components/minishop2/lexicon/ru/default.inc.php b/core/components/minishop2/lexicon/ru/default.inc.php
index 72994762c..5cdabe8f3 100644
--- a/core/components/minishop2/lexicon/ru/default.inc.php
+++ b/core/components/minishop2/lexicon/ru/default.inc.php
@@ -165,7 +165,7 @@
$_lang['ms2_system_settings'] = 'Системные настройки';
$_lang['ms2_system_settings_desc'] = 'Системные настройки miniShop2';
$_lang['ms2_type'] = 'Тип';
-$_lang['ms2_utilites'] = 'Утилиты';
-$_lang['ms2_utilites_desc'] = 'Инструменты разработчика';
+$_lang['ms2_utilities'] = 'Утилиты';
+$_lang['ms2_utilities_desc'] = 'Инструменты разработчика';
$_lang['ms2_vendors'] = 'Производители товаров';
$_lang['ms2_vendors_intro'] = 'Список возможных производителей товаров. То, что вы сюда добавите, можно выбрать в поле "vendor" товара.';
diff --git a/core/components/minishop2/lexicon/ru/manager.inc.php b/core/components/minishop2/lexicon/ru/manager.inc.php
index 3bb8065d6..396e102d0 100644
--- a/core/components/minishop2/lexicon/ru/manager.inc.php
+++ b/core/components/minishop2/lexicon/ru/manager.inc.php
@@ -152,41 +152,41 @@
$_lang['ms2_updatedon'] = 'Дата изменения';
$_lang['ms2_user'] = 'Пользователь';
$_lang['ms2_username'] = 'Логин';
-$_lang['ms2_utilites_gallery'] = 'Галерея';
-$_lang['ms2_utilites_gallery_done'] = 'Завершено';
-$_lang['ms2_utilites_gallery_done_message'] = 'Обновление превью изображений успешно завершено.';
-$_lang['ms2_utilites_gallery_err_noproducts'] = 'В каталоге нет товаров';
-$_lang['ms2_utilites_gallery_for_step'] = 'Обработать товаров за 1 шаг';
-$_lang['ms2_utilites_gallery_information'] = 'Выбранный источник файлов: {0}
Всего товаров: {2} шт.
Изображений: {3} шт. ';
-$_lang['ms2_utilites_gallery_intro'] = 'Обновление всех изображений товаров согласно указанным параметрам.
Данная операция является трудозатратной, поэтому не указывайте большое число для одной итерации.';
-$_lang['ms2_utilites_gallery_refresh'] = 'Обновить';
-$_lang['ms2_utilites_gallery_updating'] = 'Обновлению превью';
-$_lang['ms2_utilites_import'] = 'Импорт';
-$_lang['ms2_utilites_import_debug'] = 'Режим отладки';
+$_lang['ms2_utilities_gallery'] = 'Галерея';
+$_lang['ms2_utilities_gallery_done'] = 'Завершено';
+$_lang['ms2_utilities_gallery_done_message'] = 'Обновление превью изображений успешно завершено.';
+$_lang['ms2_utilities_gallery_err_noproducts'] = 'В каталоге нет товаров';
+$_lang['ms2_utilities_gallery_for_step'] = 'Обработать товаров за 1 шаг';
+$_lang['ms2_utilities_gallery_information'] = 'Выбранный источник файлов: {0}
Всего товаров: {2} шт.
Изображений: {3} шт. ';
+$_lang['ms2_utilities_gallery_intro'] = 'Обновление всех изображений товаров согласно указанным параметрам.
Данная операция является трудозатратной, поэтому не указывайте большое число для одной итерации.';
+$_lang['ms2_utilities_gallery_refresh'] = 'Обновить';
+$_lang['ms2_utilities_gallery_updating'] = 'Обновлению превью';
+$_lang['ms2_utilities_import'] = 'Импорт';
+$_lang['ms2_utilities_import_debug'] = 'Режим отладки';
$_lang['ms2_utilities_import_file_ns'] = 'Не выбран файл для импорта.';
$_lang['ms2_utilities_import_file_ext_err'] = 'Не верное расширение файла.
Разрешен только *.csv';
$_lang['ms2_utilities_import_file_nf'] = 'Файл с расположением [[+path]] не найден';
$_lang['ms2_utilities_import_fields_ns'] = 'Не заполнен параметр
Поля импорта.';
-$_lang['ms2_utilites_import_intro'] = 'Простой импорт каталога товаров.
При импорте большого объема товаров ваш сайт может зависнуть.
Рекомендуем запускать выполнение в фоновом режиме, для этого необходимо отметить чекбокс "Использовать планировщик" (требуется установленный компонент Scheduler)';
+$_lang['ms2_utilities_import_intro'] = 'Простой импорт каталога товаров.
При импорте большого объема товаров ваш сайт может зависнуть.
Рекомендуем запускать выполнение в фоновом режиме, для этого необходимо отметить чекбокс "Использовать планировщик" (требуется установленный компонент Scheduler)';
$_lang['ms2_utilities_import_key_ns'] = 'Не заполнен параметр
Уникальное поле.';
$_lang['ms2_utilities_import_success'] = 'Импорт выполнен.
Всего обработано строк: [[+total]]
Создано: [[+created]]
Обновлено: [[+updated]]';
-$_lang['ms2_utilites_import_label_delimiter'] = 'Разделитель колонок в файле';
-$_lang['ms2_utilites_import_label_fields'] = 'Поля импорта';
-$_lang['ms2_utilites_import_label_file'] = 'Файл для импорта';
-$_lang['ms2_utilites_import_label_file_empty'] = 'Выберите файл';
+$_lang['ms2_utilities_import_label_delimiter'] = 'Разделитель колонок в файле';
+$_lang['ms2_utilities_import_label_fields'] = 'Поля импорта';
+$_lang['ms2_utilities_import_label_file'] = 'Файл для импорта';
+$_lang['ms2_utilities_import_label_file_empty'] = 'Выберите файл';
$_lang['ms2_utilities_import_required_field'] = 'Пропущено обязательное поле [[+field]]';
-$_lang['ms2_utilites_import_save_fields'] = 'Сохранить настройки полей';
-$_lang['ms2_utilites_import_save_fields_title'] = 'Сохранено';
-$_lang['ms2_utilites_import_save_fields_message'] = 'Список полей для импорта сохранен';
-$_lang['ms2_utilites_import_skip_header'] = 'Пропускать первую строку-шапку';
-$_lang['ms2_utilites_import_submit'] = 'Импортировать';
-$_lang['ms2_utilites_import_update_key'] = 'Уникальное поле для обновления';
-$_lang['ms2_utilites_import_update_products'] = 'Обновить товары';
-$_lang['ms2_utilites_import_use_scheduler'] = 'Использовать планировщик';
-$_lang['ms2_utilites_params'] = 'Параметры ';
-$_lang['ms2_utilites_scheduler_nf'] = 'У вас не установлен компонент Scheduler';
-$_lang['ms2_utilites_scheduler_task_ce'] = 'Не удалось создать задание Scheduler';
-$_lang['ms2_utilites_scheduler_success'] = 'Задание Scheduler создано';
+$_lang['ms2_utilities_import_save_fields'] = 'Сохранить настройки полей';
+$_lang['ms2_utilities_import_save_fields_title'] = 'Сохранено';
+$_lang['ms2_utilities_import_save_fields_message'] = 'Список полей для импорта сохранен';
+$_lang['ms2_utilities_import_skip_header'] = 'Пропускать первую строку-шапку';
+$_lang['ms2_utilities_import_submit'] = 'Импортировать';
+$_lang['ms2_utilities_import_update_key'] = 'Уникальное поле для обновления';
+$_lang['ms2_utilities_import_update_products'] = 'Обновить товары';
+$_lang['ms2_utilities_import_use_scheduler'] = 'Использовать планировщик';
+$_lang['ms2_utilities_params'] = 'Параметры ';
+$_lang['ms2_utilities_scheduler_nf'] = 'У вас не установлен компонент Scheduler';
+$_lang['ms2_utilities_scheduler_task_ce'] = 'Не удалось создать задание Scheduler';
+$_lang['ms2_utilities_scheduler_success'] = 'Задание Scheduler создано';
$_lang['ms2_weight'] = 'Вес';
$_lang['ms2_weight_price'] = 'Стоимость ед/вес';
$_lang['ms2_weight_price_help'] = 'Добавочная стоимость доставки за единицу веса.
Может быть использовано в кастомных классах.';
diff --git a/core/components/minishop2/processors/mgr/utilites/gallery/update.class.php b/core/components/minishop2/processors/mgr/utilities/gallery/update.class.php
similarity index 98%
rename from core/components/minishop2/processors/mgr/utilites/gallery/update.class.php
rename to core/components/minishop2/processors/mgr/utilities/gallery/update.class.php
index d192ae470..567518974 100644
--- a/core/components/minishop2/processors/mgr/utilites/gallery/update.class.php
+++ b/core/components/minishop2/processors/mgr/utilities/gallery/update.class.php
@@ -65,7 +65,7 @@ public function process()
}
if (!is_array($products) || empty($products)) {
- return $this->failure($this->modx->lexicon('ms2_utilites_gallery_err_noproducts'));
+ return $this->failure($this->modx->lexicon('ms2_utilities_gallery_err_noproducts'));
}
$i = 0;
diff --git a/core/components/minishop2/processors/mgr/utilites/import/import.class.php b/core/components/minishop2/processors/mgr/utilities/import/import.class.php
similarity index 95%
rename from core/components/minishop2/processors/mgr/utilites/import/import.class.php
rename to core/components/minishop2/processors/mgr/utilities/import/import.class.php
index b05d27d26..0b5687648 100644
--- a/core/components/minishop2/processors/mgr/utilites/import/import.class.php
+++ b/core/components/minishop2/processors/mgr/utilities/import/import.class.php
@@ -84,19 +84,19 @@ public function process()
$scheduler = $this->modx->getService('scheduler', 'Scheduler', $path . 'model/scheduler/');
if (!$scheduler) {
$this->modx->log(1, 'not found Scheduler extra');
- return $this->failure($this->modx->lexicon('ms2_utilites_scheduler_nf'));
+ return $this->failure($this->modx->lexicon('ms2_utilities_scheduler_nf'));
}
$task = $scheduler->getTask('minishop2', 'ms2_csv_import');
if (!$task) {
$task = $this->createImportTask();
}
if (empty($task)) {
- return $this->failure($this->modx->lexicon('ms2_utilites_scheduler_task_ce'));
+ return $this->failure($this->modx->lexicon('ms2_utilities_scheduler_task_ce'));
}
$task->schedule('+1 second', $importParams);
- return $this->success($this->modx->lexicon('ms2_utilites_scheduler_success'));
+ return $this->success($this->modx->lexicon('ms2_utilities_scheduler_success'));
}
/**
diff --git a/core/components/minishop2/processors/mgr/utilites/import/saveconfig.class.php b/core/components/minishop2/processors/mgr/utilities/import/saveconfig.class.php
similarity index 100%
rename from core/components/minishop2/processors/mgr/utilites/import/saveconfig.class.php
rename to core/components/minishop2/processors/mgr/utilities/import/saveconfig.class.php
From 73760833dc31423d9d741c43d0b69b50652e780d Mon Sep 17 00:00:00 2001
From: webinmd <89poilo@gmail.com>
Date: Fri, 16 Jun 2023 23:55:53 +0300
Subject: [PATCH 13/19] Fix namespace
---
_build/data/transport.menu.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/_build/data/transport.menu.php b/_build/data/transport.menu.php
index ae476147b..5ac254a89 100644
--- a/_build/data/transport.menu.php
+++ b/_build/data/transport.menu.php
@@ -36,11 +36,11 @@
'menuindex' => 3,
'action' => 'mgr/help',
],
- 'ms2_utilites' => [
- 'description' => 'ms2_utilites_desc',
+ 'ms2_utilities' => [
+ 'description' => 'ms2_utilities_desc',
'parent' => 'minishop2',
'menuindex' => 4,
- 'action' => 'mgr/utilites',
+ 'action' => 'mgr/utilities',
],
];
From ad989a303882be5946d8899ab50fba12edcd14ae Mon Sep 17 00:00:00 2001
From: biz87
Date: Mon, 19 Jun 2023 22:56:06 +0600
Subject: [PATCH 14/19] fix for removing installed old incorrect menu
---
_build/build.config.php | 1 +
_build/resolvers/resolve.utilites.php | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
create mode 100644 _build/resolvers/resolve.utilites.php
diff --git a/_build/build.config.php b/_build/build.config.php
index 0cbcde4d3..3fa9cbcd0 100644
--- a/_build/build.config.php
+++ b/_build/build.config.php
@@ -54,5 +54,6 @@
'settings',
'chunks',
'statuses',
+ 'menu',
'setup',
];
diff --git a/_build/resolvers/resolve.utilites.php b/_build/resolvers/resolve.utilites.php
new file mode 100644
index 000000000..6331f75e1
--- /dev/null
+++ b/_build/resolvers/resolve.utilites.php
@@ -0,0 +1,21 @@
+xpdo) {
+ $modx = $transport->xpdo;
+ // fix for removing installed old incorrect menu
+ /** @var modMenu $menu */
+ if ($options[xPDOTransport::PACKAGE_ACTION] == xPDOTransport::ACTION_UPGRADE) {
+ $menu = $modx->getObject('modMenu', ['text' => 'ms2_utilites']);
+ if ($menu) {
+ $menu->remove();
+ unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/panel.js');
+ rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/');
+ unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/panel.js');
+ rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/');
+ }
+ }
+}
+return true;
From fcdf05c22faee97c277d4c0c51bef9bcc2eb9173 Mon Sep 17 00:00:00 2001
From: biz87
Date: Mon, 19 Jun 2023 23:01:16 +0600
Subject: [PATCH 15/19] fix name resolver
---
_build/build.config.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_build/build.config.php b/_build/build.config.php
index 3fa9cbcd0..c52759c13 100644
--- a/_build/build.config.php
+++ b/_build/build.config.php
@@ -54,6 +54,6 @@
'settings',
'chunks',
'statuses',
- 'menu',
+ 'utilites',
'setup',
];
From ae521afb173c2efb21288c42f2d3c714906c807b Mon Sep 17 00:00:00 2001
From: biz87
Date: Mon, 19 Jun 2023 23:06:22 +0600
Subject: [PATCH 16/19] Revert "fix name resolver"
This reverts commit fcdf05c22faee97c277d4c0c51bef9bcc2eb9173.
---
_build/build.config.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_build/build.config.php b/_build/build.config.php
index c52759c13..3fa9cbcd0 100644
--- a/_build/build.config.php
+++ b/_build/build.config.php
@@ -54,6 +54,6 @@
'settings',
'chunks',
'statuses',
- 'utilites',
+ 'menu',
'setup',
];
From 37b063fcb8d9ff79138c18afc5a43d34244cf64f Mon Sep 17 00:00:00 2001
From: biz87
Date: Mon, 19 Jun 2023 23:06:22 +0600
Subject: [PATCH 17/19] Revert "fix for removing installed old incorrect menu"
This reverts commit ad989a303882be5946d8899ab50fba12edcd14ae.
---
_build/build.config.php | 1 -
_build/resolvers/resolve.utilites.php | 21 ---------------------
2 files changed, 22 deletions(-)
delete mode 100644 _build/resolvers/resolve.utilites.php
diff --git a/_build/build.config.php b/_build/build.config.php
index 3fa9cbcd0..0cbcde4d3 100644
--- a/_build/build.config.php
+++ b/_build/build.config.php
@@ -54,6 +54,5 @@
'settings',
'chunks',
'statuses',
- 'menu',
'setup',
];
diff --git a/_build/resolvers/resolve.utilites.php b/_build/resolvers/resolve.utilites.php
deleted file mode 100644
index 6331f75e1..000000000
--- a/_build/resolvers/resolve.utilites.php
+++ /dev/null
@@ -1,21 +0,0 @@
-xpdo) {
- $modx = $transport->xpdo;
- // fix for removing installed old incorrect menu
- /** @var modMenu $menu */
- if ($options[xPDOTransport::PACKAGE_ACTION] == xPDOTransport::ACTION_UPGRADE) {
- $menu = $modx->getObject('modMenu', ['text' => 'ms2_utilites']);
- if ($menu) {
- $menu->remove();
- unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/panel.js');
- rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/');
- unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/panel.js');
- rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/');
- }
- }
-}
-return true;
From 9c91073ea604f614ba7bee9b56eb89a0620b34bf Mon Sep 17 00:00:00 2001
From: biz87
Date: Tue, 20 Jun 2023 00:07:07 +0600
Subject: [PATCH 18/19] fix utilites menu item
---
_build/build.config.php | 1 +
_build/resolvers/resolve.utilites.php | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 _build/resolvers/resolve.utilites.php
diff --git a/_build/build.config.php b/_build/build.config.php
index 0cbcde4d3..c52759c13 100644
--- a/_build/build.config.php
+++ b/_build/build.config.php
@@ -54,5 +54,6 @@
'settings',
'chunks',
'statuses',
+ 'utilites',
'setup',
];
diff --git a/_build/resolvers/resolve.utilites.php b/_build/resolvers/resolve.utilites.php
new file mode 100644
index 000000000..62cff50f5
--- /dev/null
+++ b/_build/resolvers/resolve.utilites.php
@@ -0,0 +1,25 @@
+xpdo) {
+ $modx = $transport->xpdo;
+ // fix for removing installed old incorrect menu
+ switch ($options[xPDOTransport::PACKAGE_ACTION]) {
+ case xPDOTransport::ACTION_INSTALL:
+ case xPDOTransport::ACTION_UPGRADE:
+ $menu = $modx->getObject('modMenu', ['text' => 'ms2_utilites']);
+ if ($menu) {
+ $menu->remove();
+ $modx->log(modX::LOG_LEVEL_ERROR, "Removed menu item \"ms2_utilites\"");
+ unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/panel.js');
+ rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/');
+ unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/panel.js');
+ rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/');
+ $modx->log(modX::LOG_LEVEL_ERROR, "Removed all files in \"utilites\"");
+ }
+ break;
+ }
+}
+return true;
From 47559d4c99689d2193ac4b7eda3cdf293d4bea75 Mon Sep 17 00:00:00 2001
From: biz87
Date: Tue, 20 Jun 2023 00:10:17 +0600
Subject: [PATCH 19/19] remove unused logs
---
_build/resolvers/resolve.utilites.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/_build/resolvers/resolve.utilites.php b/_build/resolvers/resolve.utilites.php
index 62cff50f5..2ed9fb63d 100644
--- a/_build/resolvers/resolve.utilites.php
+++ b/_build/resolvers/resolve.utilites.php
@@ -12,12 +12,10 @@
$menu = $modx->getObject('modMenu', ['text' => 'ms2_utilites']);
if ($menu) {
$menu->remove();
- $modx->log(modX::LOG_LEVEL_ERROR, "Removed menu item \"ms2_utilites\"");
unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/panel.js');
rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/gallery/');
unlink(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/panel.js');
rmdir(MODX_ASSETS_PATH . 'components/minishop2/js/mgr/utilites/');
- $modx->log(modX::LOG_LEVEL_ERROR, "Removed all files in \"utilites\"");
}
break;
}