diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 00000000..8e33492e --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,21 @@ +name: Create Release +run-name: Create release for ${{ github.event.client_payload.version }} + +on: + repository_dispatch: + types: + - craftcms/new-release + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: ncipollo/release-action@v1 + with: + body: ${{ github.event.client_payload.notes }} + makeLatest: ${{ github.event.client_payload.latest }} + name: ${{ github.event.client_payload.version }} + prerelease: ${{ github.event.client_payload.prerelease }} + tag: ${{ github.event.client_payload.tag }} diff --git a/CHANGELOG.md b/CHANGELOG.md index b59c8848..1e5b82fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Release Notes for Feed Me +## 5.1.3 - 2023-04-28 + +> **Warning** +> If you have an existing Commerce Products feed, you may need to resave its settings after updating. + +- Improved feed mapping performance for large category groups and structure sections. ([#1255](https://github.com/craftcms/feed-me/issues/1255), [#1293](https://github.com/craftcms/feed-me/pull/1293)) +- Improved Matrix field importing performance. ([#1291](https://github.com/craftcms/feed-me/issues/1291), [#1307](https://github.com/craftcms/feed-me/pull/1307)) +- Fixed a bug where “Use default value” wasn’t mapping boolean fields properly. ([#1304](https://github.com/craftcms/feed-me/issues/1304), [#1305](https://github.com/craftcms/feed-me/pull/1305)) +- Fixed a bug where imported categories could become orphaned if their parents were disabled. ([#555](https://github.com/craftcms/feed-me/issues/555)) +- Fixed a bug where pagination wasn’t working for feeds whose URL contained an alias. ([#1244](https://github.com/craftcms/feed-me/issues/1244), [#1301](https://github.com/craftcms/feed-me/pull/1301)) +- Fixed a PHP error that could occur when importing some feeds. ([#1298](https://github.com/craftcms/feed-me/issues/1298), [#1299](https://github.com/craftcms/feed-me/pull/1299)) +- Fixed a PHP error that could occur when importing a Craft Commerce product feed that contained “Post Date” or Expiry Date” fields. ([#1287](https://github.com/craftcms/feed-me/issues/1287), [#1296](https://github.com/craftcms/feed-me/pull/1296)) +- Fixed a bug where the mapping UI for Table fields didn’t include default value options. ([#1254](https://github.com/craftcms/feed-me/issues/1254), [#1300](https://github.com/craftcms/feed-me/pull/1300)) +- Fixed a bug where date and time values weren’t getting imported into Table fields properly. ([#604](https://github.com/craftcms/feed-me/issues/604), [#1300](https://github.com/craftcms/feed-me/pull/1300)) +- Fixed a bug where users’ “Preferred Locale” settings weren’t getting imported properly. ([#612](https://github.com/craftcms/feed-me/issues/612), [#1289](https://github.com/craftcms/feed-me/pull/1289)) +- Fixed a PHP error occurred if Feed Me’s logging level was set to `error`. ([#1295](https://github.com/craftcms/feed-me/issues/1295), [#1297](https://github.com/craftcms/feed-me/pull/1297)) +- Fixed a bug where entries with a custom propagation method weren’t getting imported properly. ([#1279](https://github.com/craftcms/feed-me/issues/1279), [#1292](https://github.com/craftcms/feed-me/pull/1292)) + ## 5.1.2 - 2023-04-17 - Added support for importing into CKEditor as an inner element field. @@ -14,7 +32,7 @@ - Removed the “Collapsed” checkbox from Matrix feed mapping screens. ([#709](https://github.com/craftcms/feed-me/issues/709), [#1284](https://github.com/craftcms/feed-me/pull/1284)) - Fixed an XSS vulnerability. -## 5.1.1.1 - 2023-02-24 +## 5.1.1.1 - 2023-03-24 - Fixed a PHP error that could occur when importing into some 3rd party fields. ([#1264](https://github.com/craftcms/feed-me/issues/1264), [#1265](https://github.com/craftcms/feed-me/pull/1265)) @@ -86,1409 +104,4 @@ - The `data`, `elements`, `feeds`, `fields`, `logs`, `process`, and `service` components can now be configured via `craft\services\Plugins::$pluginConfigs`. ### Removed -- Removed built-in support for the Verbb Comments plugin, which provides its own Feed Me driver. - -## 4.6.1.1 - 2023-03-24 - -- Fixed a PHP error that could occur when importing into some 3rd party fields. ([#1264](https://github.com/craftcms/feed-me/issues/1264), [#1265](https://github.com/craftcms/feed-me/pull/1265)) - -## 4.6.1 - 2023-03-20 - -- Fixed a JavaScript error that would occur on case-sensitive filesystems when using Feed Me. ([#1260](https://github.com/craftcms/feed-me/pull/1260), [#1257](https://github.com/craftcms/feed-me/issues/1257), [#1258](https://github.com/craftcms/feed-me/issues/1258), [#1259](https://github.com/craftcms/feed-me/issues/1259)) - -## 4.6.0 - 2023-03-16 - -- Added the “Set Empty Values” feed setting, which determines whether empty values in the feed should be respected or ignored. ([#1228](https://github.com/craftcms/feed-me/pull/1228), [#797](https://github.com/craftcms/feed-me/issues/797), [#723](https://github.com/craftcms/feed-me/issues/723), [#854](https://github.com/craftcms/feed-me/issues/854), [#680](https://github.com/craftcms/feed-me/issues/680)) -- Disabled elements are no longer redundantly re-disabled, drastically improving the performance of some feed imports. ([#1248](https://github.com/craftcms/feed-me/pull/1248), [#1241](https://github.com/craftcms/feed-me/issues/1241)) -- Fixed a bug where some feed element data would be considered changed even if there were no changes. ([#1220](https://github.com/craftcms/feed-me/pull/1220), [#1219](https://github.com/craftcms/feed-me/issues/1219), [#1223](https://github.com/craftcms/feed-me/pull/1223/), [#1219](https://github.com/craftcms/feed-me/issues/1219)) -- Fixed a bug where the default value modal for relational fields on the feed mapping page would show all available sources, not just the sources allowed for the field. ([#1234](https://github.com/craftcms/feed-me/pull/1234)) -- Fixed a PHP error that could occur when a feed contained an empty value that was mapped to an Assets field. ([#1229](https://github.com/craftcms/feed-me/pull/1229), [#1195](https://github.com/craftcms/feed-me/issues/1195), [#1106](https://github.com/craftcms/feed-me/issues/1106), [#1154](https://github.com/craftcms/feed-me/issues/1154)) -- Fixed a bug where empty arrays could be misinterpreted during feed imports. ([#1236](https://github.com/craftcms/feed-me/pull/1236)) -- Fixed several issues related to importing categories and Structure section entries. ([#1240](https://github.com/craftcms/feed-me/pull/1240), [#1154](https://github.com/craftcms/feed-me/issues/1154)) -- Fixed a PHP error that could occur when importing relational field data within a Matrix field. ([#1069](https://github.com/craftcms/feed-me/issues/1069)) -- Fixed a PHP error that occurred when importing an asset with a filename over 255 characters long. - -## 4.5.4 - 2023-01-09 - -### Fixed -- Fixed a PHP error that could occur when using the `--continue-on-error` flag on the `feed-me/feeds/queue` CLI command. -- Fixed a bug where sites in a Site Group would all have their statuses updated when a feed was targeting a single site. ([#1208](https://github.com/craftcms/feed-me/issues/1208)) -- Fixed importing using the LinkIt plugin. ([#1203](https://github.com/craftcms/feed-me/issues/1203)) - -## 4.5.3 - 2022-05-31 - -### Fixed -- Fixed a PHP error that could occur when importing a base64-encoded asset. -- Fixed a bug where asset file names were getting normalized before searching for an existing asset when the feed specified a file path. ([#847](https://github.com/craftcms/feed-me/issues/847)) - -## 4.5.2 - 2022-05-17 - -### Changed -- The `EVENT_AFTER_PARSE_FEED` event now passes in the feed’s ID. ([#1107](https://github.com/craftcms/feed-me/issues/1107)) - -## 4.5.1 - 2022-05-05 - -### Fixed -- Fixed a bug where elements’ per-site statuses weren’t getting set for feeds that specified a status. ([#822](https://github.com/craftcms/feed-me/issues/822)) - -## 4.5.0 - 2022-04-21 - -### Changed -- Entries imported within sections whose Propagation Method is set to “Let each entry choose which sites it should be saved to” are no longer created for all of the section’s supported sites. ([#1084](https://github.com/craftcms/feed-me/issues/1084)) - -## 4.4.3 - 2022-04-06 - -### Added -- It’s now possible to set the plugin to use a custom queue, by overriding `craft\feedme\Plugin::$queue` via `craft\services\Plugins::$pluginConfigs`, in `config/app.php`. ([craftcms/cms#5492](https://github.com/craftcms/cms/issues/5492)) - -### Fixed -- Fixed a bug where importing in Multi-select containing Optgroup would fail. - -## 4.4.2 - 2022-03-07 - -### Changed -- Exceptions are now logged in `web.log`/`console.log` in addition to Feed Me logs. - -### Fixed -- Fixed a bug that would prevent relating products in Products field. ([#1058](https://github.com/craftcms/feed-me/issues/1058)) -- Fixed a bug that would prevent changing element status on multisite when the target site was set to default. ([#606](https://github.com/craftcms/feed-me/issues/606)) -- Fixed a bug where mapping fields for an entry fieldtype wasn’t showing the correct available fields. ([#1098](https://github.com/craftcms/feed-me/pull/1098), ([#692](https://github.com/craftcms/feed-me/issues/692)), ([#825](https://github.com/craftcms/feed-me/issues/825)) - -## 4.4.1.1 - 2021-12-06 - -### Fixed -- Fixed a PHP error that could occur when importing some feeds. ([#1067](https://github.com/craftcms/feed-me/issues/1067)) ([#1041](https://github.com/craftcms/feed-me/issues/1041)) - -## 4.4.1 - 2021-12-03 - -### Changed -- The `feedId` is now passed as a parameter into the `beforeFetchFeed` and `afterFetchFeed` events. -- `craft\services\Process::processFeed()` now accepts a `$feedData` parameter that can be used to override the feed data. - -### Fixed -- Fixed a bug where mapped values could get stripped of leading zeros when doing content comparisons. -- Fixed a bug where creating or editing a feed would render an error if you were on Craft 3.7.24 or later. ([#1065](https://github.com/craftcms/feed-me/issues/1065)) - -## 4.4.0 - 2021-08-08 - -### Added -- Added support for disabling updating search indexing on a per-feed basis. ([#649](https://github.com/craftcms/feed-me/issues/649)) - -### Changed -- Feed Me now requires Craft 3.7 or later. - -### Fixed -- Fixed a bug that could occur when matching content on Entries, Categories and Users fields. ([#864](https://github.com/craftcms/feed-me/issues/864)) -- Fixed a bug that could occur if the feed value wasn’t a `string` when importing into a dropdown field. ([#853](https://github.com/craftcms/feed-me/issues/853)) -- Fixed a PHP error that could occur when trying to import a remote asset. -- Fixed a bug where Feed Me was not respecting Craft’s `allowUppercaseInSlug` config setting. ([#853](https://github.com/craftcms/feed-me/issues/865)) - -## 4.3.6 - 2021-03-05 - -### Added -- Added support for the [Google Maps](https://plugins.craftcms.com/google-maps) plugin. -- Added a `--all` option to the `feed-me/feeds/queue` console command to push all feeds into the queue. ([#783](https://github.com/craftcms/feed-me/pull/783)) - -### Changed -- Feed labels are now sorted alphabetically on the feed’s field mapping settings page. ([#812](https://github.com/craftcms/feed-me/pull/812)) - -### Fixed -- Fixed a bug where Solspace Calendar events would not import when using some recurring rules. ([#806](https://github.com/craftcms/feed-me/pull/806)) -- Fixed a bug where using the `feedOptions` config setting could unintentionally overwrite the wrong feed’s settings. ([#792](https://github.com/craftcms/feed-me/issues/792)) - -## 4.3.5.1 - 2021-02-07 - -### Fixed -- Fixed a PHP error that would occur when importing Assets. ([#804](https://github.com/craftcms/feed-me/issues/804)) - -## 4.3.5 - 2021-02-05 - -### Removed -- Removed the ralouphie/mimey library. - -### Fixed -- Fixed a bug where CSV files without a header row weren’t getting loaded properly when using league/csv 9.x. ([#798](https://github.com/craftcms/feed-me/issues/798)) -- Fixed some PHP 8 compatibility issues. ([#802](https://github.com/craftcms/feed-me/issues/802)) - -## 4.3.4 - 2020-12-14 - -### Fixed -- Fixed a bug that prevented some feeds from importing. ([#786](https://github.com/craftcms/feed-me/issues/786)) -- Fixed a PHP error that would occur when importing into a custom field named `variants`. ([#616](https://github.com/craftcms/feed-me/issues/616)) - -## 4.3.3 - 2020-12-10 - -### Fixed -- Fixed a PHP error that occurred when importing a JSON object, rather than an array (again). ([#761](https://github.com/craftcms/feed-me/issues/761)) -- Fixed a MySQL error that could occur when importing values of zero. ([#779](https://github.com/craftcms/feed-me/issues/779)) -- Fixed a bug where local filesystem feeds would not run on Windows. ([#655](https://github.com/craftcms/feed-me/issues/655)) - -## 4.3.2 - 2020-11-15 - -### Fixed -- Fixed a PHP error that could occur when importing assets. ([#355](https://github.com/craftcms/feed-me/issues/355)), ([#747](https://github.com/craftcms/feed-me/issues/747)) - -## 4.3.1 - 2020-11-09 - -### Fixed -- Fixed a bug where feeds’ import strategy settings would get reset to the default values when editing existing feeds. ([#769](https://github.com/craftcms/feed-me/issues/769)) -- Fixed a bug where assets with uppercase file extensions wouldn’t import on case-sensitive file systems. ([#691](https://github.com/craftcms/feed-me/issues/691)) -- Fixed a bug that broke asset importing in 4.3.0. - -## 4.3.0 - 2020-11-06 - -### Added -- It’s now possible to import Single sections’ entry data. ([#559](https://github.com/craftcms/feed-me/issues/559)) -- It’s now possible to import global set data. ([#670](https://github.com/craftcms/feed-me/issues/670)) -- Added the `feed-me/feeds/queue` command. ([#754](https://github.com/craftcms/feed-me/issues/754), [#626](https://github.com/craftcms/feed-me/issues/626)) -- Added `craft\feedme\elements\GlobalSet`. -- Added `craft\feedme\models\ElementGroup`. -- Added `craft\feedme\models\FeedModel::$singleton`. - -### Changed -- Feed Me now requires Craft 3.5 or later. -- Cleaned up log messages when there are no items in a feed to process. ([#585](https://github.com/craftcms/feed-me/issues/585)) -- Elements’ `getGroups()` methods can now return `craft\feedme\models\ElementGroup` objects. -- Updated ralouphie/mimey to v2.1. ([#740](https://github.com/craftcms/feed-me/issues/740)) - -### Removed -- Removed the `feed-me/feeds/run` command. The new `feed-me/feeds/queue` command can be used instead, in combination with `queue/run`. - -### Fixed -- Fixed a bug where it was possible to configure feeds with validation issues. ([#757](https://github.com/craftcms/feed-me/issues/757)) -- Fixed a SQL error that occurred when importing products in Commerce 3.2.8 or later. -- Fixed a bug where assets would end up with an incorrect filename when the filename was used for a mapping in the feed settings. ([#750](https://github.com/craftcms/feed-me/issues/750)) -- Fixed a bug where custom fields would have their content assigned to the primary site instead of the feed’s target site. ([#658](https://github.com/craftcms/feed-me/issues/658)) -- Fixed a bug where assets would always be imported to the primary site instead of the feed’s target site. ([#725](https://github.com/craftcms/feed-me/pull/725)) -- Fixed a PHP error that occurred when importing content to a mapped Dropdown field. ([#732](https://github.com/craftcms/feed-me/pull/732)) -- Fixed a PHP error that occurred when importing a JSON object, rather than an array. ([#761](https://github.com/craftcms/feed-me/issues/761)) -- Fixed a bug where an existing enabled entry wouldn’t be disabled if a matching feed item was marked as disabled. ([#760](https://github.com/craftcms/feed-me/pull/760)) -- Fixed a bug where unique identifier checkboxes had extra spacing between them. ([#727](https://github.com/craftcms/feed-me/issues/727)) -- Fixed a SQL error that occurred when importing a feed item with a missing field and no default value set. ([#527](https://github.com/craftcms/feed-me/issues/527)) -- Fixed a bug where an entry’s default status was ignored for a section on multi-site installs. ([#541](https://github.com/craftcms/feed-me/issues/541)) -- Fixed an error that could occur when using an alternate queue driver. ([#553](https://github.com/craftcms/feed-me/issues/553)) -- Fixed a bug where the final screen after editing a feed would say that the feed was being processed even though it wasn’t. ([#638](https://github.com/craftcms/feed-me/issues/638)) - -## 4.2.4 - 2020-10-01 - -### Fixed -- Fixed a bug where pagination would break if a feed provided a root relative pagination URL. -- Fixed a bug where pagination would break if a feed provided an invalid URL. ([#694](https://github.com/craftcms/feed-me/issues/694)) - -## 4.2.3 - 2020-05-12 - -### Fixed -- Fixed a bug where all elements would be disabled if the “Add” and “Disable” strategies were used together. ([#696](https://github.com/craftcms/feed-me/issues/696)) - -## 4.2.2 - 2020-03-26 - -### Changed -- Feed Me now requires Craft 3.4 or later. - -### Deprecated -- Deprecated `craft\feedme\helpers\AssetHelper::queryHash()`. - -### Fixed -- Fixed a bug where the “Save” and “Save and continue” buttons were hanging off the bottom of the page. ([#664](https://github.com/craftcms/feed-me/issues/664)) -- Fixed a bug where Feed Me would report that processing was complete when it wasn’t. ([#664](https://github.com/craftcms/feed-me/issues/664)) -- Fixed a PHP error when importing assets from URLs with query strings, on PHP 7.4 or later. ([#682](https://github.com/craftcms/feed-me/issues/682)) - -## 4.2.1.1 - 2020-03-17 - -### Fixed -- Fixed a typo in the changelog. - -## 4.2.1 - 2020-03-17 - -### Added -- Added support for the Entries Subset field type. ([#686](https://github.com/craftcms/feed-me/pull/686)) - -### Changed -- Feed importing jobs now use the queue’s default `ttr` and `attempts` settings if the `queueTtr` and `queueMaxRetry` settings haven’t been set in `config/feed-me.php`. ([#662](https://github.com/craftcms/feed-me/issues/662)) - -### Fixed -- Fixed some bugs with importing and displaying related entries that have a disabled status. ([#645](https://github.com/craftcms/feed-me/issues/645)) - -## 4.2.0.1 - 2020-01-15 - -### Fixed -- Fixed a bug that broke local feeds. ([#647](https://github.com/craftcms/feed-me/issues/647)) - -## 4.2.0 - 2020-01-02 - -### Changed -- Added a fail-safe when assigning default authors to entries to ensure lookup is always done against the user’s ID. ([#627](https://github.com/craftcms/feed-me/issues/627)) - -### Fixed -- Fixed a bug that could occur when importing default values to Checkboxes or Multi-select fields. -- Fixed support for the Linkit plugin. ([#615](https://github.com/craftcms/feed-me/issues/615)) -- Fixed compatibility with Craft 3.4. ([#643](https://github.com/craftcms/feed-me/issues/643)) -- Fixed a bug where Feed Me wasn’t prepared for the possibility that an event handler for `craft\feedme\services\Process::EVENT_BEFORE_PROCESS_FEED` could alter the total number of feed items to process. ([#619](https://github.com/craftcms/feed-me/pull/619)) - -## 4.1.2 - 2019-08-11 - -### Fixed -- Fixed a bug where multi-site elements were only getting saved in the site chosen in the feed settings. ([#564](https://github.com/craftcms/feed-me/issues/564)) -- Fixed an error that occurred when choosing a default user photo on case-sensitive file systems. -- Fixed an error that occurred when importing a user without a photo, if a default user photo had been chosen. ([#562](https://github.com/craftcms/feed-me/issues/562)) -- Fixed a bug where it wasn’t possible to install Feed Me on projects requiring PHP dotenv 3. ([#588](https://github.com/craftcms/feed-me/issues/588)) - -## 4.1.1 - 2019-07-06 - -### Changed -- It’s now possible for `onAfterParseField` event handlers to modify parsed field values by overriding the `$parsedValue` property on the event. ([#516](https://github.com/craftcms/feed-me/issues/516)) - -### Fixed -- Fixed an issue that could happen when trying to import tags. -- Fixed a missing PHP class import. ([#563](https://github.com/craftcms/feed-me/issues/563)) - -## 4.1.0 - 2019-04-24 - -### Added -- Added the “Disable missing elements in the target site” Import Strategy option. ([#517](https://github.com/craftcms/feed-me/issues/517)) - -### Changed -- Renamed the “Sites” setting to “Target Site”, which now specifies the _initial_ site that elements should be saved in, rather than the _only_ site. ([#521](https://github.com/craftcms/feed-me/issues/521)) -- Improved JSON feed parsing performance. ([#510](https://github.com/craftcms/feed-me/issues/510)) - -### Fixed -- Fixed a bug where imported dates were assumed to be set in the system time zone even if they specified something else. -- Fixed a bug where custom message translations weren’t getting registered for JavaScript. -- Fixed a PHP error that could occur when editing or creating a feed, if Commerce, Digital Products, Calendar, or Comments were Composer-installed but not enabled. - -## 4.0.0 - 2019-04-09 - -### Changed -- Feed Me is now available as a single, free edition. -- The package name is now `craftcms/feed-me`. -- The root namespace is now `craft\feedme`. -- Feed Me now requires Craft 3.1.21 or later. - -## 3.1.17 - 2019-04-07 - -### Added -- Add `assetDownloadCurl` option. -- Add Tag element support. -- Add `sortOrder` for feeds. - -### Changed -- Allow `beforeFetchFeed` the ability to set the feed’s response. -- Allow empty date values to be included in field data. -- Port additional boolean-like values from Craft 2 version. (thanks @jamesmacwhite). -- Create slug the same way as Craft. (thanks @smcyr). - -### Fixed -- Fix Matrix mapping not applying default values. -- Refactor unique identifier check, including inherited fields. -- Error-handle a little for custom datatypes from Craft 2. -- Fix Simple Map integration. -- Ensure correct element scenario is set for element fields, when set to create. -- Fix some fields throwing errors due to namespacing. - -## 3.1.16 - 2019-03-22 - -### Added -- Add more logging info around assets and uploading. -- Add logging info for all element fields and their matching criteria. -- Add `queueTtr` and `queueMaxRetry` for queue timeout handling. - -### Fixed -- Add siteId check to category parent matching. Thanks (@pieter-janDB). -- Elements should inherit the `enabled` value for `enabledForSite` in multi-site setups. -- Add siteId migration (just in case). -- Update Craft 2>3 migration to include table updates when no feeds exist. -- Comments - add URL to mapping. - -## 3.1.15 - 2019-03-09 - -### Added -- Add option to create folders for asset imports. - -### Fixed -- Fix un-mapped fields being processed incorrectly in some cases. -- Fix assets not actually using the correct folder mapping config. -- Update schema version - just in case its an issue for C2 upgrades. -- Fix handling of asset folders when importing assets. - -## 3.1.14 - 2019-03-08 - -### Added -- Added support for native editions. - -## 3.1.13 - 2019-03-08 - -### Fixed -- Fix element fields with their own element fields not having their values set on feeds. -- Fix help controller field error. -- Fix parsing mapped values a little too eagerly for Matrix fields, potentially ignoring mapping for other element fields. - -## 3.1.12 - 2019-03-03 - -### Fixed -- Ensure all complex fields don’t process when none of their sub-fields are mapped. - -## 3.1.11 - 2019-03-02 - -### Added -- Added config option to run Garbage Collection before a feed starts. - -### Fixed -- Ensure complex fields (Matrix, etc) don’t process when none of their sub-fields are mapped. - -## 3.1.10 - 2019-02-26 - -### Fixed -- Allow comments owner to match on custom fields. -- Fix compatibility with latest Comments release, add missing commentDate. -- Comments - Remove unneeded custom save function thanks to `Element::SCENARIO_ESSENTIALS` disabling validation. -- Remove `Db::escapeParam()` when directly querying (not required and causing matching issues). - -## 3.1.9 - 2019-02-22 - -### Fixed -- Add support for league/csv:^9.0, where some combinations of plugins loaded this version instead of 8.0. Caused some CSVs to show as empty. -- Ensure entries created through their fields respect their default status. -- Fix entries section not being selected properly in mapping. -- Ease up on comparing content - doesn’t need to match exact type. - -## 3.1.8 - 2019-02-17 - -### Fixed -- Fix element fields not finding existing elements when `Relate digital products from a specific site?` was set on the field. - -## 3.1.7 - 2019-02-16 - -### Fixed -- Fix primary element selector showing incorrect values when two nested nodes have the same name. -- Switch variant parsing behaviour to support nested levels less than 2 first. -- Remove assumption that empty arrays should be ignored. -- Ensure third-party fields check for empty data before returning. -- Ensure element fields check for empty data before returning. - -## 3.1.6 - 2019-02-15 - -### Added -- Add console command to run feeds. Refer to [docs](https://docs.craftcms.com/feed-me/v4/feature-tour/trigger-import-via-cron.html#console-command) -- Implement log file rotation - stop them getting out of hand -- Add more date formatting options. - -### Changed -- Add better content checks for number and lightswitch. -- Add better checks for element groups (user groups) content. -- Improve checking against existing date content. -- Update asset fields to use `resolveDynamicPathToFolderId` by default. Should match field settings more consistently. - -### Fixed -- Ensure blank CSV rows are stripped out. -- Ensure when matching against existing data that there’s values to compare against. Prevents againt matching incorrectly. -- Try to fix `A non-numeric value encountered` error. -- Fix error in help controller when no field found. -- Fix entry/category matching against parents correctly. -- Fix Postgres error when no sources for element fields are selected. -- Ensure values trim for whitespace, if strings. - -## 3.1.5 - 2019-02-11 - -### Changed -- Refactor `afterProcessFeed` to work with pagination. - -### Fixed -- Fix lightswitch default value not saving. -- Fix typo in user profile photo uploads. -- Fix checking for entry’s default status for section. -- Fix searching for existing assets not using the prepped filename. -- Fix elements being disabled/deleted incorrectly for paginated feeds. - -## 3.1.4 - 2019-02-06 - -### Fixed -- Fix user photo upload and issues. -- Fix syntax error in help controller. - -## 3.1.3 - 2019-02-06 - -### Fixed -- Fixed `EVENT_BEFORE_PROCESS_FEED` change from 3.1.2 causing issues in feed processing. - -## 3.1.2 - 2019-02-02 - -### Changed -- Support `nesbot/carbon` `^1.22 || ^2.10` -- Support `league/csv` `^8.2 || ^9.0` - -### Fixed -- `EVENT_BEFORE_PROCESS_FEED` process event can actually modify variables (thanks @monachilada). -- Always include a root node for primary element. - -## 3.1.1 - 2019-02-01 - -### Added -- Updates to asset element importing, including “URL or Path” field. -- Added docs guide for asset element importing (finally, right). - -### Changed -- Add some more clarity around errors in help requests. -- Update processing events to be cancelable and modify params. -- Upgrades to nesbot/carbon ^2.10. -- Allow `getSelectOptions()` to modify the `none` option. -- Alphabetise help feeds. - -### Fixed -- Fix primary elements not showing all levels of options to pick from. -- Fix error occurring when `parseTwig` was set to true. -- When creating elements via fields, ensure they’re created in the same siteId as the owner element. -- Fix asset field matching local assets. -- Fix import issues when values contain data delimiter with whitespace around the delimiter. -- Updates to asset element importing, fixing a few issues. -- Fix asset fields not matching existing assets. - -## 3.1.0 - 2019-01-21 - -### Added -- Added full support for Craft 3.1 (now also minimum version). Thanks to all the contributors! -- Added beforeSave() for elements. -- Allows SELECT_DATES to be imported for Solspace Calendar events. (thanks @samstevens). - -### Changed -- Add better handling for milliseconds and seconds timestamps. Date fields can now choose which timestamp is used in their feed. -- Refactor asset element imports, particularly for remote uploads. Prevents asset duplication and fixes element fields not being populated. - -### Fixed -- Add checks around third-party elements if they exist but aren’t installed. -- Add conditionals around element field layouts throwing errors in some cases. -- Fix element mapping templates throwing errors in some cases. -- Fix some element fields not matching elements properly when selecting specific types. -- Fix mapping element fields with no field layout. -- Fix empty string values not being imported into fields, in some cases, for some fields. -- Fix potential error occurring when incorrectly configuring an element and trying to proceed to mapping screen. -- Fix not fetching node content when the node contains a dot character. -- Include `resolveDynamicPathToFolderId()` in asset field matching to resolve to dynamic folders correctly. - -## 3.0.2.1 - 2018-12-13 - -### Fixed -- Fix `SCENARIO_ESSENTIALS` error from 3.0.2. - -## 3.0.2 - 2018-12-12 - -### Added -- Added `logging` config option. - -### Fixed -- Fix `SCENARIO_ESSENTIALS` not being applied for products and comments. -- Fix elements being disabled/deleted with `compareContent` on. - -## 3.0.1 - 2018-12-06 - -### Changed -- All element titles will be truncated automatically if over 255 characters. - -### Fixed -- Fix SQL error when setting a default author. -- Fix `matchExistingElement` not supporting false-y values. -- Fix Matrix/Super Table support for nested (complex) fields. -- Fix SQL error ocurring when mapping a parent entry. -- Fix Assets (and other) elements not having their modified data saved properly in some instances. - -## 3.0.0 - 2018-11-28 - -### Added -- Add JSON linter for better parsing errors. -- Add `composer.json` and `composer.lock` to support requests. -- Add `onAfterParseFeed` event. -- Add `sleepTime` config setting, to set `sleep()` on each feed processing. - -### Changed -- Selecting a default author now uses an element select field. -- Clarify suspending users with disabling elements. -- Make a few more events modifiable. - -### Fixed -- Fix template tags not working properly. -- Fix pagination URL not saving. -- Assets - ensure existing element is set/updated when fetching image. -- Fix matrix fields not grouping content correctly for JSON feeds. -- Ensure element fields, when set to create, respect the feed propagation settings. -- Return empty array when no data for element fields -- Do not make redirect request after install if install is done via CLI. Thanks (@nettum). -- Fix for some fields not saving their mapping options inside Matrix. - -## 3.0.0-beta.30 - 2018-11-15 - -### Fixed -- Fix error thrown by datatypes when using template tags (properly). - -## 3.0.0-beta.29 - 2018-11-15 - -### Fixed -- Fix user status not working correctly, or throwing an error if setting to active. -- Fix content checks not comparing existing content correctly. -- Fix error thrown by datatypes when using template tags. -- Refactor and fix variants not working with Matrix fields (and other complex fields). - -## 3.0.0-beta.28 - 2018-11-13 - -### Fixed -- Fix conflict with Navigation plugin migration - -## 3.0.0-beta.27 - 2018-11-13 - -### Added -- Added pagination handling for feeds. Select a node in your feed that contains a URL to the next set of data for your content, and Feed Me will automatically fetch it. -- Added content comparison functionality, where Feed Me will look at all your existing content for an element, compare it, and only proceed if content has changed. This brings massive performance improvements by not needlessly updating elements. Also controlled through `compareContent` as a config setting, default to true. -- Added Google Sheet as a datatype. -- Added type switch for logs - filter your logs by info, error or all. -- Added `feedOptions` config for feed-specific settings. Control request headers per-feed, or change any feed attribute in your configuration file. - -### Changed -- Set `SCENARIO_ESSENTIALS` scenario when saving an element. In-line with how Craft handles bulk element updates, and to integrate nicely with [SEOmatic](https://github.com/nystudio107/craft-seomatic). -- All element fields now return unique IDs. -- Provide more detail for XML parsing errors. -- Users - set user to be suspended when disabling elements. - -### Fixed -- Fix enabled tabs throwing an error in some cases. -- Fix error thrown when matching elements on their ID. -- Fix not matching entries and categories across multi-sites. -- Fix not being able to select filename as an identifier for asset fields. -- Cleanup and properly sort settings and config options. -- Move extra element attribute setting within parseTwig conditional, ensuring elements are bound twice with attribute and field data. -- Fix categories fields not limiting per their field settings. -- Add serialise and normalise for default field content, particularly useful with Redactor. -- Fix additional Linkit data being added to import. -- Implement table field sub-field validations. -- Fix Table fields not containing all columns when null values. -- Fix Matrix including order and not setting collapsed/disabled to boolean. -- Fix Matrix not handling scenario when only adding content to one block type. - -## 3.0.0-beta.26 - 2018-11-01 - -### Changed -- Limit logs entries in the UI to 300. -- Switch `dataDelimiter` from `|` to `-|-` - causing too many issues with Twig. -- Twig parsing in field content or default values is now opt-in. Use an array of field handles or attribute handles in a config setting `parseTwig`. - -### Fixed -- Fix error when trying to match against custom field in category, entry and user fields. -- Allow to map against Preparse element field content. -- Fix missing FeedMe class definitions. -- Protect debug output from console requests. -- Fix element field matching. - -## 3.0.0-beta.25 - 2018-10-26 - -### Changed -- All new logging! More logging and more details. - -### Fixed -- Fixed an error with Super Table fields (thanks @jaydensmith). - -## 3.0.0-beta.24 - 2018-10-24 - -### Changed -- Tighten restrictions on what can be a unique identifier field. -- Improve local file handling a little and relative paths. -- CSV - allow files without headers to still be processed instead of throwing an error. - -### Fixed -- AssetHelper - add checks for spaces in filenames. -- Add array-handling to default fields, preventing errors like `trim()`, etc. -- Add some conditionals to migration from Craft 2 > 3. -- Fix template error when updating Craft 2 > 3. - -## 3.0.0-beta.23 - 2018-10-23 - -### Added -- Added support for [Digital Products](https://github.com/craftcms/digital-products) element and field. -- Added support for [Solspace Calendar](https://github.com/solspace/craft3-calendar) element and field. -- Added support for [Comments](https://github.com/verbb/comments) element. -- Added support for [Super Table](https://github.com/verbb/super-table) field. -- Added support for [Linkit](https://github.com/fruitstudios/craft-linkit) field. -- Added support for [Typed Link](https://github.com/sebastian-lenz/craft-linkfield) field. -- Added support for [SimpleMap](https://github.com/ethercreative/simplemap) field. -- Add offset/limit options to template params - -### Changed -- Matrix handling, particularly for XML-based feeds are much more opinionated about structure for better results. See [docs](https://docs.craftcms.com/feed-me/v4/guides/importing-into-matrix.html#note-on-structure). - -### Fixed -- Fix element fields in Matrix not mapping correctly. -- Fix Twig parsing in default and feed data too early, resulting in empty values. -- Matrix - fix block types with no fields messing things up. -- Fix `placeholder` in products query causing PostgreSQL errors. -- Fix error thrown on entry mapping screen when no sections are available. -- Assets - fix filename matches not including subfolders. -- Table - protect against array values importing into fields. - -## 3.0.0-beta.22 - 2018-10-04 - -### Fixed -- Fixed an error when trying to match relational entries via a custom field. -- Fix integrity constraint error thrown by author. - -## 3.0.0-beta.21 - 2018-08-21 - -### Fixed -- Fix typos in element classes - -## 3.0.0-beta.20 - 2018-08-21 - -### Changed -- Drop support for email fields for users (potentially causing conflicts) - -### Fixed -- Fix incorrect tab URLs -- Error checking entry section -- Fix entries field error when trying to access a section has been deleted -- Fix element-creation not finding existing elements of any status - -## 3.0.0-beta.19 - 2018-08-18 - -### Changed -- Ensure element fields don’t throw fatal errors when unable to save - allowing owner element to continue. -- Products - remove required attribute on unlimited stock. -- Change element field matching existing elements querying. Fixes the case where trying to match elements with the keyword `not` in the value. - -### Fixed -- Fix primary element iterator when only one item in feed (in some cases). -- Fix enabled tabs in CP not working. -- Fix error thrown for table field when no delimiter defined. -- Fix for inner-element fields for entries throwing an error. -- Fix Matrix blocks not being sorted correctly in cases where they’re paired with element fields. - -## 3.0.0-beta.18 - 2018-08-16 - -### Added -- Add support for Table fields and `dataDelimiter` for multiple rows. -- Allow commerce variants to set their enabled state. -- Add ability to store base64 encoded assets in addition to URLs (thanks @urbantrout). -- Added config option for csv delimiter `csvColumnDelimiter` (thanks @crollalowis) - -### Changed -- Improve user-creation handling for user fields. -- Matrix - Refactor parsing logic to be (hopefully) better. -- Matrix - swap enabled with disabled checkbox for blocks. -- Improve product variants, preventing orphans in some cases. -- Provide field option for handling existing user groups. Either fully replace existing user groups, or append. -- Prevent elements from propagating when targeting a site. - -### Fixed -- Assets - fix incorrect skipping of existing assets when there aren’t necesarily any found. -- Table - Fix processing changes when no delimiter (not required). -- Use registerTwigExtension(), otherwise may cause Twig to be loaded before it should be (thanks @brandonkelly) -- Entry - Fix authors not being created when they should be. -- CSV - fix for line breaks in headings causing issues. -- Fix for variants in that they can potentially move to another product type, or otherwise plucked from a product other than the one you’re importing. -- Fix incorrect variant custom field namespace. - -## 3.0.0-beta.17 - 2018-07-19 - -### Changed -- Replace `getReferrer()` which redirects inconsistently. -- Add item/row number into log message. - -### Fixed -- Fix edge-case for importing a single item (and only one). -- Ensure values are escaped when comparing existing elements. -- Products - ensure attributes are set properly in all instances. -- Products - fix custom fields not being set on variants. -- Fix `Undefined variable: variants`. -- Fix miss-spelling of `dataDelimiter`. -- Fix invalid reference to TagElement in Users element class. -- Fix user status not being able to bet set via the element anymore. -- Protect against setting element attributes when null. - -## 3.0.0-beta.16 - 2018-07-07 - -### Added -- Add support for element fields to match on simple custom fields -- Allow element fields to select default elements -- Add config option for data delimeter (`dataDelimiter`) - -### Changed -- Add `prepareAssetName` to asset handler to handle filenames better - -### Fixed -- Fix help errors ocurring in some cases -- Fix date format parsing -- Fix date fields not passing formatting options to helper -- Add safety checks for boolean values needing to be a string -- Fix some element attributes not being set correctly -- Fix default value and values not respecting falsey values in field mapping -- Fix product variants not using the default value -- Fix product variant data not showing in debug -- Fix `services/Fields.php::parseField()` unknown property `$feed` is set. -- Fix dropdown field (and others) not respecting the default value -- Commerce - fix missing `BaseHelper` - -## 3.0.0-beta.15 - 2018-06-12 - -### Added -- Commerce Element support -- Commerce Products field support -- Commerce Variants field support -- Added more default options for fields - -### Changed -- Improve process service by allowing events to modify variables - -### Fixed -- Fixed handling of lightswitch fields -- Fix element-matching not throwing an error when it should -- Entry - Fix parent not being created when checked -- Entry - Don’t show section options for parent -- Entry/Category - Support `targetSiteId` setting -- Element fields should match existing elements regardless of (site) status -- Allow multi-site entry/category fields to match correctly (for the same site) -- Minor visual fix for mapping checkboxes -- Assets - Fix for asset-upload filename. Did not take into account query string when creating a filename from a dynamically generated URL -- Minor fix for PHP 7.2 when no items are available to process in the feed - -## 3.0.0-beta.14 - 2018-05-23 - -### Fixed - -- Minor fix for table column ordering -- Fix lack of parent category-creation -- Add logging for category creation -- Fix handling of entries fields when limited to singles -- Fix table mapping not using the correct column handle - -## 3.0.0-beta.13 - 2018-05-08 - -### Fixed - -- Fix for feed items not continuing after encountering a processing error - -## 3.0.0-beta.12 - 2018-05-08 - -### Added - -- Add support for [Smart Map](https://github.com/doublesecretagency/craft-smartmap) - -### Fixed - -- Improve CSV handling, particular for Windows-generated files which can have encoding issues -- Fix bug with not being able to select all primary elements -- Fix PHP 7.2 warnings -- Improve performance of content parsing for attributes and custom fields - -## 3.0.0-beta.11 - 2018-05-05 - -### Fixed - -- Fixed error thrown by unique identifier (caused in beta.10) - -## 3.0.0-beta.10 - 2018-05-04 - -### Added - -- Support aliases in feed URL -- Support date as unique identifier - -### Fixed - -- Fix relative paths not working -- Fix matching existing elements with special characters -- Improve handling of remote asset handling when `HEAD` requests fail -- Fix help widget -- Improve date-helper to handle `0` -- Table - ensure dates are parsed - -## 3.0.0-beta.9 - 2018-04-28 - -### Fixed - -- Fix errors for help form causing zip file not to send -- Fix additional options not working for Matrix fields - -## 3.0.0-beta.8 - 2018-04-27 - -### Fixed - -- Missing version number (sigh) - -## 3.0.0-beta.7 - 2018-04-27 - -### Fixed - -- Add better support for Matrix fields in Help requests -- Add conditional around entry field section/types - -## 3.0.0-beta.6 - 2018-04-24 - -### Changed - -- Tighten restrictions on allowed sub-element fields - -### Fixed - -- Fix complex data not respecting `usedefault` -- Matrix - fix for complex fields not processing just their subset of data. -- Fix a few missing translation namespaces -- Fix processing of `{` in content, where Feed Me thinks this is a Twig short tag -- Fix missing collapsed option for Matrix fields -- Fix entries section/type not being hidden initially - -## 3.0.0-beta.5 - 2018-04-22 - -### Added - -- Added support for `yyyymmdd` and `yyyyddmm` date formats -- Added options to select section/type for entry fields when creating new entries - -### Fixed - -- Fix user status not being set for users -- Fix incorrect author being set on entries -- Fix error thrown by fields that have `default` attributes -- Fixed sub-element sources throwing errors - -## 3.0.0-beta.4 - 2018-04-11 - -### Fixed - -- Revert update `league/csv` dependancy - -## 3.0.0-beta.3 - 2018-04-10 - -### Fixed - -- Fix database column type for backup option causing issues -- Update `league/csv` dependancy -- Prevent element fields matching all existing elements when not provided a value -- Fix compatibility with Craft Client/Solo -- Check before trying to split pipe characters in values -- Fix backup option being switched off - -## 3.0.0-beta.2 - 2018-04-04 - -### Fixed - -- Fix leftover `fieldElementMapping` references - - -## 3.0.0-beta.1 - 2018-04-03 - -> {warning} Feed Me 3.0.0 is a major release with significant, breaking changes. Be sure to back up your existing Feed Me 2.x.x settings. In most cases, you’ll be required to re-map fields to your feed data, as this has been heavily changed and improved. - -### Added -- Support for Craft 3, and all that comes with it. -- Support for CSV importing. -- New settings pane for each feed (on the Feeds page) stores useful links for Debug, Duplicate and Direct Feed URL. -- Primary Element setup is now much easier/clearer with preview of available nodes, rather than a text input. Should help with understanding this critical setting. Full preview coming in v3.1 -- Unit tests for parsing logic, feed consumption and more. -- Added more hooks for feed fetching, element parsing, field parsing, and processing. -- Added `limit` and `offset` parameters when running a feed via the Direct Feed URL or Debug. -- Added mapping option for selecting to always use the default value, even when not mapping the field. Handy for mass populating data without feed values. -- Added support for pipe `|` character to separate multiple field contents for element fields. Useful when Categories for instance are supplied as `Category 1|Category 2`. This is also the only method of mapping multiple items to a single field when using CSV. - -### Changed -- Completely re-written parsing logic for feed data, supported by unit tests. This is boring to most, but exciting for the stability of the plugin :) -- Improved handling of attribute mapping, now more options for things like dates. Now acts and uses the same logic for fields. -- Better handling of default field values under the hood. -- Lots of smaller improvements pathing the way to more major changes in 3.1.0. -- Better support for uploading remote assets (a little faster too). -- When running from the command line (curl, wget, etc), feed processing will wait until it’s finished before ending the request. -- Improved UI for mapping complex fields (Matrix, Table). Includes setting collapsed state for Matrix fields. -- Improved UI for mapping sub-element fields. Fields are hidden by default and can be toggled to provide better visual clarity. -- Improved UI for logs, also shows log `type` to easily pick up errors. -- When a feed fails or contains errors it will no longer show the red error symbol for the queue job. Errors are recorded in the logs, but it won’t cause other queue jobs to prevent being run, and notifying clients of an error. -- Logs now capture additional information of line/file when exceptions occur. -- utilise Guzzle for all HTTP requests, rather than new instances of Curl. -- Improved Help widget to utilise API for sending emails, not relying on local relay. Caused immeasurable amount of issues for people try to get support! - -## 2.0.11 - 2017-12-14 - -### Fixed -- Fixed incorrectly setting `localeEnabled` behaviour for entries. -- Fixed issue related to backups, causing feeds to fail when triggered via the control panel. - -## 2.0.10 - 2017-12-13 - -### Added -- Add `backupLimit` config option to control the number of backups to retain (when backups are in use). -- Products can now have their sub-element fields mapped to. - -### Changed -- Improve response when triggered via cron to not return the full page response. -- Better support for timestamps provided with milliseconds. - -### Fixed -- Fix a bug that occured when disable/delete elements is your import strategy. -- Update entries to only apply localeEnabled when dealing with locales. -- Fix for CP becoming unresponsive when running a feed from the control panel directly. -- Fix to ensure local-testing works as expected without a license. -- Fix for Commerce Products default values not being properly sorted into variant data. -- Fixed an issue when triggering feeds from CLI. ([#262](https://github.com/craftcms/feed-me/pull/262)) -- Fix for date attributes not checking for falsey values before returning current date. -- Fix for locale entries not having their status set as per the default section status. - -## 2.0.9 - 2017-10-18 - -### Fixed -- Fixed icon mask. -- Fixed incorrect license servers for new licenses. - -## 2.0.8 - 2017-10-17 - -### Added -- Add headers from feed request to special `_headers` variable for template requests -- Create `feedHeaders` template call -- Add commerce products fieldtype support - -### Changed -- Better handle boolean values for elements. -- Refactor status screen. -- Users - allow importing into multiple user groups. -- Users - support remote-uploading of profile image. -- Visual improvements to nested element fields. -- Matrix - Allow block enabled status to be set. -- Reset properties to allow an instance of the ProcessService to be reused.. -- Support additional boolean values for fields and attributes. -- Date - Add date formatting options for date field. -- Ensure each run of the feed uses a fresh criteria model. -- Matrix - improvements for Super Table handling. -- Add extra truthy detections for `live` and `enabled`. - -### Fixed -- Load custom (fixed) version of selectize to fix being unable to un-select defaults. -- Matrix - fix default value to not be enabled (don’t map). -- Table - properly normalise data. -- Users - minor fix for groupId checking. -- Fix feed not getting immediately processed when running from the CP. -- Fix minor issue with categories calling ids() twice. -- Fix regex for short-hand twig detection. -- Fix for Table field not processing more than 10 rows. -- Ensure more than just plain sub-element field are styed correctly. -- Elements - Ensure we properly escape `{` characters, and don’t assume they’re short-hand twig. -- Entries fieldtype - don’t rely on parent element being a section. -- Assets - Fix folder-mapping from 2.0.7 (requires re-mapping). -- Support for limitAutoSlugsToAscii for element slugs. -- Remove Ajax task-triggering from direct-run template. In cases, this can cause the feed to be run twice, running from Cron. -- Commerce - using existing variant Title when not provided. -- Honour default entry status for sections. -- Slight modification to regex processing. -- Fix incorrect function calls for help request and certain fields. -- Commerce - Tax and Shipping category now supports ID, Name and Handle. -- Fix bug that causes datetimes not to be adjusted for timezones on import. -- Clean field-mapping options and fields when saving, and the field isn’t being mapped. -- Check Matrix field data if it has any field content - otherwise will create empty blocks. -- Allow complex fields to have their defaults set correctly. - -## 2.0.7 - 2017-06-22 - -### Added -- Assets - Added folder option for dynamic sub-folders (via feed), or by selecting specific default folders within selected source. -- Add default field for element IDs -- Allow elements to use date attributes as unique identifier. -- Add backup logging. -- Add duplicate feed option, and move into first screen. -- New Status screen - start feed processing from here, or come back to view the process of a running one. -- Add `limit` and `offset` params to debug. - -### Changed -- Use selectize for mapping dropdowns. Allows for quick-searching of data. -- Ensure elements can handle Twig shortcode. -- Link to logs/home on import success page. -- Better text on asset-uploading options fields - hopefully explains better. - -### Fixed -- Products - Fix single variant handling. -- Fix a typo for `Disableed`. -- Fix for Table field in Matrix. -- Fix potential SQL error when setting entries to disabled. Thanks @lindseydiloreto. -- Products - Fix single variant handling. -- Ensure inner-element fields check for existing content. -- Fix date fields not parsing twig variables early. -- Minor fix for asset importing not expecting array of urls. -- Fix to check empty string passed in as date. -- Minor fixes for `defaultUploadLocationSource` checks. -- Improve Matrix-handling when referencing data outside of repeatable Matrix-ready content (you’re correct that sounds complex). -- Fix related entries escaping title. -- Fix regex to handle node names that end in digit. Thanks @antcooper. -- Minor fix for Table fields and normalising data. -- Fix Commerce Variants not calling `postForFieldType`. - -## 2.0.6 - 2017-05-19 - -### Added -- Allow option-select fields (Dropdown, Checkboxes, etc) to specify whether data is provided as its value or label - -### Changed -- Prevent against specifying incorrect handles for fields or attributes for default field values (using twig) -- Check categories (and other fields) have correct settings before fetching custom fields -- Ensure required fields get their data populated when targeting a specific locale. Otherwise, will cause the feed to fail due to validation. - -### Fixed -- Users - fixed replacing current user group assignments -- Minor fix for complex/uneven Matrix fields -- Fix to check for existing parsed data and merge, rather than overwrite -- Fix Product/Variant imports not working correctly - -## 2.0.5 - 2017-05-12 - -### Added -- Added `checkExistingFieldData` for all fields to first check an existing element (if any) has content matching exactly what is to be imported. It will be skipped if it matches. Controlled by config setting, and off by default. - -### Changed -- Provide better checking for set DateTime object for all date fields. -- Better support for null data in feed. -- Refactoring feed data parsing (for the last time!) for more reliable results with inconsistent feeds/nodes/data. Much better handling of order of data, nested content, and repeatable nodes. - -### Fixed -- Fix asset inner-element fields when remote-uploading. -- Fix asset `postFieldData` fetching incorrect field data. -- Fix asset filename guessing to handle more robust filenames. -- Remove unnecessary log when testing for timestamp. - -## 2.0.4 - 2017-05-03 - -### Added -- Allow Twig shorthand variables to be used in default fields. This allows you to reference other fields or element attributes in the feed. -- Add `nesbot/carbon` for proper date parsing. Now properly supports Unix timestamps for date data. -- Smart extension/filename checking for remote asset URLs. This smartly grabs the correct URL from the base path, or query string. - -### Changed -- Commerce Variants - pre-fill existing attribute values if they aren’t mapped in the feed. -- Include more default fields for element types. - -### Fixed -- Fixed issue with setting Category status. -- Fixed data issue in `BaseFeedMeFieldType:postFieldData()`. - -## 2.0.3 - 2017-04-30 - -### Added -- Added Locale Status to entries, to properly control individual locale status. -- Added `element` parameter to `onStepProcessFeed` event. -- Added Import Strategy to `Disable missing elements`. Thanks [@ryansnowden](https://github.com/ryansnowden). - -### Changed -- Refactor remote asset uploading/handling. -- Remote assets - Better support for dynamic paths set in asset fields (ie `{slug}`). -- Remote assets - When set to `Keep Original`, don’t download it and then check if it exists in Craft - it can be skipped. -- Ensure all fields are bootstrapped with the owner element being imported. -- Improve Commerce Products matching on existing elements (including better variant-field support). -- Remove certain unique identifier options for Product Variants - the element criteria doesn’t support them anyway. -- Refactor `matchExistingElement` to return a single element, as opposed to a collection. -- Improve checking for unique identifier for all element types. - -### Fixed -- Remote assets - Ensure field limits are respected. -- Remote assets - Ensure multi remote asset fields work correctly in the same feed. -- Fix for entry field not showing correct sub-element fields. -- Fix for Matrix and remote asset field uploading. - -## 2.0.2 - 2017-03-29 - -### Added -- Provide `all` locale option instead of always requiring one. - -### Changed -- Refactored Asset element type importing, include locale content. -- Better support for Craft Client default author for elements. -- Empty date/time can now be set for date fields. -- Improved Checkbox/Radio/Multiselect data parsing. -- Plugin events are now triggered when calling the debug action. -- Long URLs are now truncated on feeds index in the CP. -- Improved assets-uploading without extension. - -### Fixed -- Properly support third-party element types. -- Properly support third-party data types. ([#172](https://github.com/craftcms/feed-me/pull/172)) -- Fixed default value for dropdown field (when no value matches). -- Better error-handling when importing into specific locale. -- Ensure default start/date are correctly parsed entries/commerce. -- Ensure checks for element attributes include fallback. Can cause issues with fields with handles the same as element attributes. -- Lightswitch field now properly check for boolean values. -- Fixed User Photos not being mapped. -- Fixed `preferredLocale` not being mapped to users. -- Fixed logging license response on ping. This caused an error to be raised during feed processing at times. -- Fixed for Asset Element not matching against filename data. -- Fixes for Matrix/Table importing. - -## 2.0.1 - 2017-02-28 - -### Fixed -- Products - Fix existing element-matching on core attributes (matching against title, etc) -- Products - Ensure content is set correctly for multi-locales -- Users - Fix profile fields not importing when multi-locales were setup. -- Fix data-parsing when using via templates. Particular if an error occurs, an error would be thrown, preventing logging of the error. -- Ensure `unregisterLicenseKey` and `transferLicenseKey` properly decode server response. - -## 2.0.0 - 2017-02-24 - -### Feed Me 2.0 is a major update -- Before updating, please read the [upgrade notes](https://sgroup.com.au/plugins/feedme/guides/updating-from-1-x-x). This version contains several potentially breaking changes. - -### Added -- Added support for Categories, Users, Entries, Commerce Products -- Support for third-party element types -- Auto-upload Assets when mapping -- Support to map content to element’s inner fields (think fields for assets) -- Added Assets ElementType - easily upload assets into Craft. -- Direct access to mapping screen -- Support attribute-mapping for XML feeds -- Added Debug controller action to help debug those tricky feeds, and see whats going on -- Support for third-party data-types, in addition to the native JSON/XML processing. Useful for custom data handling -- Added debug icon to Feeds index. -- Added Element ID mapping. *A word of warning - * do not use this for importing new data. [Read more](https://sgroup.com.au/plugins/feedme/feature-tour/field-mapping#element-iDs). -- Added parent-mapping for Entry and Category. -- Elements can be created if they don’t exist -- Assets can be uploaded automatically, with options for conflict handling -- Added support to map element fields’ own custom fields (think fields for assets). Currently only supports simple fields. -- Support for importing Categories, Users, Entries, Commerce Products -- Support for third-party Element Types using `registerFeedMeElementTypes` -- Added `onBeforeProcessFeed`, `onProcessFeed`, and `onStepProcessFeed` events -- Added `registerFeedMeDataTypes`, `registerFeedMeElementTypes`, and `registerFeedMeFieldTypes` hooks -- Added ability to clear logs -- Added ability to clear pending tasks - can be called via Cron -- Dedicated plugin page via [http://sgroup.com.au/plugins/feedme](http://sgroup.com.au/plugins/feedme) -- Start to finish examples -- Examples for JSON/RSS/XML feeds -- Developer resources for hooks and events - -### Changed -- Matrix smart-checking for existing content -- New parsing method for XML feeds, includes attribute-mapping -- New mapping interface allows setting defaults for most fields -- Re-written field-mapping functionality (again) to be more robust and future-proof. -- Import Strategy is now no longer a single choice. Choose any combination of Add/Update or Delete. -- Locale-specific importing. Previously imported the same content across locales. -- Support for save shortcut, and stays on the same screen, rather than redirecting back to index -- Better feedback screen when unable to parse/find feed -- Feed mapping now looks at entire feed structure for nodes, rather than just the first node -- Feed mapping is no longer case-insensitive -- Proper confirmation screen when importing, with progress bar -- Feeds no longer die when an error occurs. It’ll try to complete the rest of the feed, notifying you of errors at the end of processing. -- Sub-folders are now searched for existing assets. -- Improved handling of inconsistent, repeatable nodes (I’m looking at you XML). -- Asterisks are now shown during mapping for required fields - a handy reminder. -- User importing no longer requires a User Group set. -- More modular handling by moving to separate classes -- More streamlined third-party integration and implementation using `registerFeedMeFieldTypes` -- Improved performance for Element fields - replaces `search` with attributes (ie: `asset->filename` over `asset->search`). -- Matrix fields now smartly look at existing content and update only if data has changed. No more element bloat. -- Improved logging information across the plugin -- Better feedback when help requests fail - -### Fixed -- Remove database logging (no longer used) -- Fix support for local feeds -- Feed no longer lags when processing from the control panel -- Fix issue where task wouldn’t fire asynchronously, locking up the CP -- Fixed issue where pending/disabled existing entries weren’t being matched for updating/deleting -- Prevent feed from processing if there are no nodes to process. Fixes deletion when elements shouldn’t be -- Treat boolean-like values with the respect they deserve. -- Added Shipping Category for Commerce Products. -- Fixes to Help requests not validating - therefore unable to send -- Help request form supports CSRF protection - as it should - -## 1.4.12 - 2016-07-05 - -### Changed -- Altered terminology around Duplication Handling to hopefully be more clearer. - -### Fixed -- Protect against errors on Feed Me index page when sections/entry types no longer exist. -- Fixed mapping issues with Table field inside Matrix blocks. -- Fixed Dropdown field matching via Label, not Value. - -## 1.4.11 - 2016-04-25 - -### Fixed -- Fixed issue with XML parsing and special characters encoding incorrectly. - -## 1.4.10 - 2016-04-13 - -### Fixed -- Fixed issue for repeatable fields containing empty values (table fields). - -### Changed -- FeedUrl attribute stored as `TEXT` column type to allow for longer URLs. -- Improved JSON parsing to use Yii’s JsonHelper class, with better logging when failing. - -## 1.4.9 - 2016-03-15 - -### Fixed -- Fixed issue with utf8 encoding for feeds. - -### Changed -- Improvements to matrix processing. - -## 1.4.8 - 2016-03-02 - -### Added -- Fix for json parsing when special characters in feed content. - -### Changed -- Better logging when a feed cannot be parsed. - -## 1.4.7 - 2016-02-28 - -### Added -- Added support for locales - set which locale you want your feed to go to. -- Added support for non-http protocols for feeds (ftp://, file://, etc). ([#29](https://github.com/craftcms/feed-me/issues/29)) - -## 1.4.6 - 2016-01-19 - -### Fixed -- Fixed an issue where an error would be incorrectly thrown when Add duplication handling is used. - -## 1.4.5 - 2016-01-13 - -### Fixed -- Fixed issue with plugin release feed url. - -## 1.4.4 - 2015-12-27 - -### Fixed -- Fixed issue with irregular nested elements. ([#24](https://github.com/craftcms/feed-me/issues/24#issuecomment-167106972)) - -## 1.4.3 - 2015-12-01 - -### Fixed -- Check for both numeric and string single-string arrays. Particularly an issue for JSON feeds. - -## 1.4.2 - 2015-11-27 - -### Changed -- Minor improvements for plugin icons. - -## 1.4.1 - 2015-11-26 - -### Fixed -- Fix css/js resources filename, which did not commit properly. - -## 1.4.0 - 2015-11-25 - -### Added -- Craft 2.5 support, including release feed and icons. -- Added `registerFeedMeMappingOptions` for third-party fieldtypes to control the options for mapping feed nodes to field data. -- Added `postForFeedMeFieldType` for third-party fieldtypes to modify entry data before being saved to entry. - -### Changed -- Code cleanup and refactoring field-mapping logic for performance and sanity. -- Rewritten Matrix/Table mapping and processing logic. **Matrix and Table fields will need to be re-mapped**. -- Removed Super Table native support - please ensure you have the 0.3.9 release of Super Table. **Super Table fields will need to be re-mapped**. -- Less strict user matching - should match against almost any value related to user. -- Allow for Environment Variables to be used in the feed url. -- Better feedback on feed failure. Will fail task if _any_ feed node encounters an issue, and will show the red failed task indicator (prompting you to look at the logs). -- Modified third-party hooks `prepForFeedMeFieldType` so it actually works! Thanks go to [@lindseydiloreto](https://github.com/lindseydiloreto). - -### Fixed -- Fix for mapping multiple Matrix blocks being out of order from original feed. -- Fix issue with task not firing when running from Control Panel. In some cases, this meant not even logging information was being recorded if something went wrong. This did not effect running directly. - -## 1.3.6 - 2015-11-25 - -- Removed `file_get_contents` as default method of fetching feed data in favour of Curl. -- Better error logging when trying to consume feed data. -- Fix for when mapping to Matrix field, commas were escaping content into new blocks. -- Ensure fields within Matrix and SuperTable are parsed through necessary field processing functions. -- Added `prepForFeedMeFieldType` hook for other plugins to handle their own fields. - -## 1.3.5 - 2015-11-25 - -- Minor fix for logging. When Delete duplication option was set, import success was never recorded in the logs. - -## 1.3.4 - 2015-11-25 - -- Minor fix for template mapping. Caused an issue when using a JSON feed and came across a empty nested array. - -## 1.3.3 - 2015-11-25 - -- Minor fix for log reporting which wasn’t displaying errors in a useful way. - -## 1.3.2 - 2015-11-25 - -- Alterations to logging information to provide better feedback. Thanks to [@russback](https://github.com/russback). - -## 1.3.1 - 2015-11-25 - -- Fix for info/notice log messages not saving when `devMode` is off. - -## 1.3.0 - 2015-11-25 - -- Refactored direct processing to utalize Craft’s tasks service, rather than using pure PHP processing. This greatly improves performance as PHP processing would run out of memory extremely quickly. - -## 1.2.9 - 2015-11-25 - -- Added support for [SuperTable](https://github.com/engram-design/SuperTable). -- Added log tab to read in `craft/storage/runtime/logs/feedme.log`. -- Added help tab, allowing users to submit their feed info and setup for debugging/troubleshooting. -- Fix for fields in Matrix blocks only succesfully mapping textual fields. Complex fields such as Assets, Entries, etc were not mapping correctly. -- Fix for only one item being processed when Delete duplication handling was selected. -- Fix for Dropdown/RadioButtons causing a critical error when a provided value didn’t exist in the field. -- Added credit and plugin url to footer. - -## 1.2.8 - 2015-11-25 - -- Move changelog - so much change! -- Add support for attribute values for XML feeds (template tags only). -- Add missing log statement for successful update/add. - -## 1.2.7 - 2015-11-25 - -- Fix where entries would not import if mapping element fields had more values that their field limit. -- Fix for multiple matches found on existing categories, where only one should match. -- Fix for escaping special characters in tags/category name. -- Minor fix for tags/category mapping. - -## 1.2.6 - 2015-11-25 - -- Fix for matching fields containing special characters. -- Fix for tags and category mapping, mapping all available if supplied empty value. -- Fix for backup lightswitch reflecting the saved state. -- Fix to ensure at least one duplicate field is checked. - -## 1.2.5 - 2015-11-25 - -- Refactoring for performance improvements. -- Remove database logging until a better performing option is figured out. Logging still occurs to the file system under `craft/storage/runtime/logs/`. -- Added optional backup option per-feed (default to true). -- Minor fix so direct feed link doesn’t use `siteUrl`. - -## 1.2.4 - 2015-11-25 - -- Added support to fallback on cURL when `file_get_contents()` is not available. Can occur on some hosts where `allow_url_fopen = 0`. - -## 1.2.3 - 2015-11-25 - -- Primary Element is no longer required - important for JSON feeds. -- Fixes for when no primary element specified. It’s pretty much optional now. -- UI tidy for mapping table. -- Fix for duplication handling not matching in some cases. Now uses element search. - -## 1.2.2 - 2015-11-25 - -- JSON feed support. - -## 1.2.1 - 2015-11-25 - -- Matrix support. -- Table support. -- Even better element-search. -- Remove square brackets for nested field - serialization issues. **Breaking change** you will need to re-map some fields due to this fix. -- Fix for supporting multiple entry types when selecting fields to map. - -## 1.2 - 2015-11-25 - -- Lots of fixes and improvements for direct-processing. Includes URL parameter, passkey and non-Task processing. -- Fixes with logging - now more informative! -- Improvement nested element parsing. -- Better date parsing. -- CSRF protection compatibility. -- Fix for duplicate field mapping not being remembered. - -## 1.1 - 2015-11-25 - -- Prep for Table/Matrix mapping. -- Better depth-mapping for feed data (was limited to depth-2). -- Refactor field-mapping processing. -- Set minimum Craft build. - -## 1.0 - 2015-11-25 - -- Initial release. +- Removed built-in support for the Verbb Comments plugin, which provides its own Feed Me driver. \ No newline at end of file diff --git a/composer.lock b/composer.lock index b1a2e937..2ff7462a 100644 --- a/composer.lock +++ b/composer.lock @@ -793,16 +793,16 @@ }, { "name": "craftcms/cms", - "version": "4.4.3", + "version": "4.4.8", "source": { "type": "git", "url": "https://github.com/craftcms/cms.git", - "reference": "d1edaf139b2245dda24fe172a80ec58c5c1a1174" + "reference": "c2947a7633375432d23dbbf11c21b4b6cc415650" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/craftcms/cms/zipball/d1edaf139b2245dda24fe172a80ec58c5c1a1174", - "reference": "d1edaf139b2245dda24fe172a80ec58c5c1a1174", + "url": "https://api.github.com/repos/craftcms/cms/zipball/c2947a7633375432d23dbbf11c21b4b6cc415650", + "reference": "c2947a7633375432d23dbbf11c21b4b6cc415650", "shasum": "" }, "require": { @@ -813,7 +813,7 @@ "craftcms/server-check": "~2.1.2", "creocoder/yii2-nested-sets": "~0.9.0", "elvanto/litemoji": "^4.3.0", - "enshrined/svg-sanitize": "~0.15.0", + "enshrined/svg-sanitize": "~0.16.0", "ext-bcmath": "*", "ext-curl": "*", "ext-dom": "*", @@ -832,7 +832,7 @@ "monolog/monolog": "^2.3", "php": "^8.0.2", "pixelandtonic/imagine": "~1.3.3.1", - "samdark/yii2-psr-log-target": "^1.1", + "samdark/yii2-psr-log-target": "^1.1.3", "seld/cli-prompt": "^1.0.4", "symfony/http-client": "^6.0.3", "symfony/var-dumper": "^5.0|^6.0", @@ -842,7 +842,7 @@ "voku/stringy": "^6.4.0", "webonyx/graphql-php": "~14.11.5", "yiisoft/yii2": "~2.0.47.0", - "yiisoft/yii2-debug": "~2.1.19.0", + "yiisoft/yii2-debug": "~2.1.22.0", "yiisoft/yii2-queue": "~2.3.2", "yiisoft/yii2-symfonymailer": "^2.0.0" }, @@ -901,14 +901,14 @@ "yii2" ], "support": { - "docs": "https://docs.craftcms.com/v3/", + "docs": "https://craftcms.com/docs/4.x/", "email": "support@craftcms.com", "forum": "https://craftcms.stackexchange.com/", "issues": "https://github.com/craftcms/cms/issues?state=open", "rss": "https://github.com/craftcms/cms/releases.atom", "source": "https://github.com/craftcms/cms" }, - "time": "2023-03-16T18:21:00+00:00" + "time": "2023-04-25T17:56:18+00:00" }, { "name": "craftcms/oauth2-craftid", @@ -1473,25 +1473,26 @@ }, { "name": "enshrined/svg-sanitize", - "version": "0.15.4", + "version": "0.16.0", "source": { "type": "git", "url": "https://github.com/darylldoyle/svg-sanitizer.git", - "reference": "e50b83a2f1f296ca61394fe88fbfe3e896a84cf4" + "reference": "239e257605e2141265b429e40987b2ee51bba4b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/e50b83a2f1f296ca61394fe88fbfe3e896a84cf4", - "reference": "e50b83a2f1f296ca61394fe88fbfe3e896a84cf4", + "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/239e257605e2141265b429e40987b2ee51bba4b4", + "reference": "239e257605e2141265b429e40987b2ee51bba4b4", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^7.0 || ^8.0" + "ezyang/htmlpurifier": "^4.16", + "php": "^5.6 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.5 || ^8.5" + "phpunit/phpunit": "^5.7 || ^6.5 || ^8.5" }, "type": "library", "autoload": { @@ -1512,9 +1513,9 @@ "description": "An SVG sanitizer for PHP", "support": { "issues": "https://github.com/darylldoyle/svg-sanitizer/issues", - "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.15.4" + "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.16.0" }, - "time": "2022-02-21T09:13:59+00:00" + "time": "2023-03-20T10:51:12+00:00" }, { "name": "ezyang/htmlpurifier", @@ -1579,22 +1580,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.5.0", + "version": "7.5.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" + "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", - "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9", + "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.9 || ^2.4", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -1687,7 +1688,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.0" + "source": "https://github.com/guzzle/guzzle/tree/7.5.1" }, "funding": [ { @@ -1703,7 +1704,7 @@ "type": "tidelift" } ], - "time": "2022-08-28T15:39:27+00:00" + "time": "2023-04-17T16:30:08+00:00" }, { "name": "guzzlehttp/promises", @@ -1791,22 +1792,22 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.4.4", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf" + "reference": "b635f279edd83fc275f822a1188157ffea568ff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf", - "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/b635f279edd83fc275f822a1188157ffea568ff6", + "reference": "b635f279edd83fc275f822a1188157ffea568ff6", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1 || ^2.0", "ralouphie/getallheaders": "^3.0" }, "provide": { @@ -1826,9 +1827,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "2.4-dev" } }, "autoload": { @@ -1890,7 +1888,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.4" + "source": "https://github.com/guzzle/psr7/tree/2.5.0" }, "funding": [ { @@ -1906,11 +1904,11 @@ "type": "tidelift" } ], - "time": "2023-03-09T13:19:02+00:00" + "time": "2023-04-17T16:11:26+00:00" }, { "name": "illuminate/collections", - "version": "v9.52.4", + "version": "v9.52.7", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", @@ -1965,7 +1963,7 @@ }, { "name": "illuminate/conditionable", - "version": "v9.52.4", + "version": "v9.52.7", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -2011,7 +2009,7 @@ }, { "name": "illuminate/contracts", - "version": "v9.52.4", + "version": "v9.52.7", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -2059,7 +2057,7 @@ }, { "name": "illuminate/macroable", - "version": "v9.52.4", + "version": "v9.52.7", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -2296,16 +2294,16 @@ }, { "name": "league/oauth2-client", - "version": "2.6.1", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/thephpleague/oauth2-client.git", - "reference": "2334c249907190c132364f5dae0287ab8666aa19" + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/2334c249907190c132364f5dae0287ab8666aa19", - "reference": "2334c249907190c132364f5dae0287ab8666aa19", + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/160d6274b03562ebeb55ed18399281d8118b76c8", + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8", "shasum": "" }, "require": { @@ -2360,22 +2358,22 @@ ], "support": { "issues": "https://github.com/thephpleague/oauth2-client/issues", - "source": "https://github.com/thephpleague/oauth2-client/tree/2.6.1" + "source": "https://github.com/thephpleague/oauth2-client/tree/2.7.0" }, - "time": "2021-12-22T16:42:49+00:00" + "time": "2023-04-16T18:19:15+00:00" }, { "name": "mikehaertl/php-shellcommand", - "version": "1.6.4", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/mikehaertl/php-shellcommand.git", - "reference": "3488d7803df1e8f1a343d3d0ca452d527ad8d5e5" + "reference": "e79ea528be155ffdec6f3bf1a4a46307bb49e545" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/3488d7803df1e8f1a343d3d0ca452d527ad8d5e5", - "reference": "3488d7803df1e8f1a343d3d0ca452d527ad8d5e5", + "url": "https://api.github.com/repos/mikehaertl/php-shellcommand/zipball/e79ea528be155ffdec6f3bf1a4a46307bb49e545", + "reference": "e79ea528be155ffdec6f3bf1a4a46307bb49e545", "shasum": "" }, "require": { @@ -2406,22 +2404,22 @@ ], "support": { "issues": "https://github.com/mikehaertl/php-shellcommand/issues", - "source": "https://github.com/mikehaertl/php-shellcommand/tree/1.6.4" + "source": "https://github.com/mikehaertl/php-shellcommand/tree/1.7.0" }, - "time": "2021-03-17T06:54:33+00:00" + "time": "2023-04-19T08:25:22+00:00" }, { "name": "moneyphp/money", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/moneyphp/money.git", - "reference": "c8eeeb1f7b7e6ca95490b94a301dc9cb8cb76c2d" + "reference": "9682220995ffd396843be5b4ee1e5f2c2d6ecee2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/moneyphp/money/zipball/c8eeeb1f7b7e6ca95490b94a301dc9cb8cb76c2d", - "reference": "c8eeeb1f7b7e6ca95490b94a301dc9cb8cb76c2d", + "url": "https://api.github.com/repos/moneyphp/money/zipball/9682220995ffd396843be5b4ee1e5f2c2d6ecee2", + "reference": "9682220995ffd396843be5b4ee1e5f2c2d6ecee2", "shasum": "" }, "require": { @@ -2495,9 +2493,9 @@ ], "support": { "issues": "https://github.com/moneyphp/money/issues", - "source": "https://github.com/moneyphp/money/tree/v4.1.0" + "source": "https://github.com/moneyphp/money/tree/v4.1.1" }, - "time": "2022-12-19T20:35:32+00:00" + "time": "2023-04-11T09:18:34+00:00" }, { "name": "monolog/monolog", @@ -2865,24 +2863,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "dfc078e8af9c99210337325ff5aa152872c98714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", + "reference": "dfc078e8af9c99210337325ff5aa152872c98714", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -2914,9 +2915,54 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" + }, + "time": "2023-03-27T19:02:04+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.20.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6c04009f6cae6eda2f040745b6b846080ef069c2", + "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } }, - "time": "2022-10-14T12:47:21+00:00" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.3" + }, + "time": "2023-04-25T09:01:03+00:00" }, { "name": "pixelandtonic/imagine", @@ -3084,21 +3130,21 @@ }, { "name": "psr/http-client", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -3118,7 +3164,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", @@ -3130,27 +3176,27 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/master" + "source": "https://github.com/php-fig/http-client/tree/1.0.2" }, - "time": "2020-06-29T06:28:15+00:00" + "time": "2023-04-10T20:12:12+00:00" }, { "name": "psr/http-factory", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { "php": ">=7.0.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -3170,7 +3216,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", @@ -3185,31 +3231,31 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/master" + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" }, - "time": "2019-04-30T12:38:16+00:00" + "time": "2023-04-10T20:10:41+00:00" }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -3224,7 +3270,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -3238,9 +3284,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/log", @@ -3694,16 +3740,16 @@ }, { "name": "symfony/console", - "version": "v5.4.21", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9" + "reference": "3cd51fd2e6c461ca678f84d419461281bd87a0a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9", - "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9", + "url": "https://api.github.com/repos/symfony/console/zipball/3cd51fd2e6c461ca678f84d419461281bd87a0a8", + "reference": "3cd51fd2e6c461ca678f84d419461281bd87a0a8", "shasum": "" }, "require": { @@ -3768,12 +3814,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.21" + "source": "https://github.com/symfony/console/tree/v5.4.22" }, "funding": [ { @@ -3789,7 +3835,7 @@ "type": "tidelift" } ], - "time": "2023-02-25T16:59:41+00:00" + "time": "2023-03-25T09:27:28+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3860,16 +3906,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.21", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f0ae1383a8285dfc6752b8d8602790953118ff5a" + "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f0ae1383a8285dfc6752b8d8602790953118ff5a", - "reference": "f0ae1383a8285dfc6752b8d8602790953118ff5a", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1df20e45d56da29a4b1d8259dd6e950acbf1b13f", + "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f", "shasum": "" }, "require": { @@ -3925,7 +3971,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.21" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.22" }, "funding": [ { @@ -3941,7 +3987,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-03-17T11:31:58+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -6859,16 +6905,16 @@ }, { "name": "yiisoft/yii2-debug", - "version": "2.1.19", + "version": "2.1.22", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-debug.git", - "reference": "84d20d738b0698298f851fcb6fc25e748d759223" + "reference": "c0fa388c56b64edfb92987fdcc37d7a0243170d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/84d20d738b0698298f851fcb6fc25e748d759223", - "reference": "84d20d738b0698298f851fcb6fc25e748d759223", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/c0fa388c56b64edfb92987fdcc37d7a0243170d7", + "reference": "c0fa388c56b64edfb92987fdcc37d7a0243170d7", "shasum": "" }, "require": { @@ -6945,7 +6991,7 @@ "type": "tidelift" } ], - "time": "2022-04-05T20:35:14+00:00" + "time": "2022-11-18T17:29:27+00:00" }, { "name": "yiisoft/yii2-queue", @@ -7847,16 +7893,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.7", + "version": "1.10.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975" + "reference": "d232901b09e67538e5c86a724be841bea5768a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975", - "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", + "reference": "d232901b09e67538e5c86a724be841bea5768a7c", "shasum": "" }, "require": { @@ -7905,7 +7951,7 @@ "type": "tidelift" } ], - "time": "2023-03-16T15:24:20+00:00" + "time": "2023-04-19T13:47:27+00:00" }, { "name": "phpunit/php-code-coverage", @@ -8227,16 +8273,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", "shasum": "" }, "require": { @@ -8309,7 +8355,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.7" }, "funding": [ { @@ -8325,7 +8372,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2023-04-14T08:58:40+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/Plugin.php b/src/Plugin.php index 89a19439..7925e88b 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -61,7 +61,7 @@ public static function config(): array ]; } - public string $minVersionRequired = '4.4.0'; + public string $minVersionRequired = '4.4.8'; public string $schemaVersion = '5.1.0.0'; public bool $hasCpSettings = true; public bool $hasCpSection = true; diff --git a/src/base/DataType.php b/src/base/DataType.php index cfdedc9e..a08c6997 100644 --- a/src/base/DataType.php +++ b/src/base/DataType.php @@ -3,6 +3,7 @@ namespace craft\feedme\base; use Cake\Utility\Hash; +use Craft; use craft\base\Component; use craft\helpers\UrlHelper; @@ -47,6 +48,9 @@ public function setupPaginationUrl($array, $feed): void $flatten = Hash::flatten($array, '/'); $url = Hash::get($flatten, $feed->paginationNode); + // resolve any aliases in the pagination URL + $url = Craft::getAlias($url); + // if the feed provides a root relative URL, make it whole again based on the feed. if ($url && UrlHelper::isRootRelativeUrl($url)) { $url = UrlHelper::hostInfo($feed->feedUrl) . $url; diff --git a/src/elements/Category.php b/src/elements/Category.php index e587ec81..c0631e5f 100644 --- a/src/elements/Category.php +++ b/src/elements/Category.php @@ -113,9 +113,11 @@ public function afterSave($data, $settings): void $parent = Hash::get($data, 'parent'); if ($parent && $parent !== $this->element->id) { - $parentCategory = CategoryElement::findOne(['id' => $parent]); + $parentCategory = CategoryElement::find()->status(null)->id($parent)->one(); - Craft::$app->getStructures()->append($this->element->group->structureId, $this->element, $parentCategory); + if ($parentCategory) { + Craft::$app->getStructures()->append($this->element->group->structureId, $this->element, $parentCategory); + } } } @@ -144,10 +146,14 @@ protected function parseParent($feedData, $fieldInfo): ?int return null; } - if ($node === 'usedefault') { + if ($node === 'usedefault' || $value === $default) { $match = 'elements.id'; } + if (is_array($value)) { + $value = $value[0]; + } + $query = CategoryElement::find() ->status(null) ->andWhere(['=', $match, $value]); diff --git a/src/elements/Entry.php b/src/elements/Entry.php index d8af9186..4463fe58 100644 --- a/src/elements/Entry.php +++ b/src/elements/Entry.php @@ -13,6 +13,7 @@ use craft\feedme\helpers\DataHelper; use craft\feedme\models\ElementGroup; use craft\feedme\Plugin; +use craft\helpers\ElementHelper; use craft\helpers\Json; use craft\models\Section; use DateTime; @@ -96,11 +97,24 @@ public function getGroups(): array */ public function getQuery($settings, array $params = []): mixed { + $targetSiteId = Hash::get($settings, 'siteId') ?: Craft::$app->getSites()->getPrimarySite()->id; + if ($this->element !== null) { + $section = $this->element->getSection(); + } + $query = EntryElement::find() ->status(null) ->sectionId($settings['elementGroup'][EntryElement::class]['section']) - ->typeId($settings['elementGroup'][EntryElement::class]['entryType']) - ->siteId(Hash::get($settings, 'siteId') ?: Craft::$app->getSites()->getPrimarySite()->id); + ->typeId($settings['elementGroup'][EntryElement::class]['entryType']); + + if (isset($section) && $section->propagationMethod === Section::PROPAGATION_METHOD_CUSTOM) { + $query->site('*') + ->preferSites([$targetSiteId]) + ->unique(); + } else { + $query->siteId($targetSiteId); + } + Craft::configure($query, $params); return $query; } @@ -136,6 +150,41 @@ public function setModel($settings): ElementInterface return $this->element; } + /** + * Checks if $existingElement should be propagated to the target site. + * + * @param $existingElement + * @param array $feed + * @return ElementInterface|null + * @throws Exception + * @throws \craft\errors\SiteNotFoundException + * @throws \craft\errors\UnsupportedSiteException + * @since 5.1.3 + */ + public function checkPropagation($existingElement, array $feed) + { + $targetSiteId = Hash::get($feed, 'siteId') ?: Craft::$app->getSites()->getPrimarySite()->id; + + // Did the entry come back in a different site? + if ($existingElement->siteId != $targetSiteId) { + // Skip it if its section doesn't use the `custom` propagation method + if ($existingElement->getSection()->propagationMethod !== Section::PROPAGATION_METHOD_CUSTOM) { + return $existingElement; + } + + // Give the entry a status for the import's target site + // (This is how the `custom` propagation method knows which sites the entry should support.) + $siteStatuses = ElementHelper::siteStatusesForElement($existingElement); + $siteStatuses[$targetSiteId] = $existingElement->getEnabledForSite(); + $existingElement->setEnabledForSite($siteStatuses); + + // Propagate the entry, and swap $entry with the propagated copy + return Craft::$app->getElements()->propagateElement($existingElement, $targetSiteId); + } + + return $existingElement; + } + // Protected Methods // ========================================================================= @@ -189,10 +238,14 @@ protected function parseParent($feedData, $fieldInfo): ?int return null; } - if ($node === 'usedefault') { + if ($node === 'usedefault' || $value === $default) { $match = 'elements.id'; } + if (is_array($value)) { + $value = $value[0]; + } + $query = EntryElement::find() ->status(null) ->andWhere(['=', $match, $value]); @@ -253,6 +306,8 @@ protected function parseParent($feedData, $fieldInfo): ?int protected function parseAuthorId($feedData, $fieldInfo): ?int { $value = $this->fetchSimpleValue($feedData, $fieldInfo); + $default = DataHelper::fetchDefaultArrayValue($fieldInfo); + $match = Hash::get($fieldInfo, 'options.match'); $create = Hash::get($fieldInfo, 'options.create'); $node = Hash::get($fieldInfo, 'node'); @@ -262,12 +317,12 @@ protected function parseAuthorId($feedData, $fieldInfo): ?int return null; } - if (is_array($value)) { - $value = $value[0]; + if ($node === 'usedefault' || $value === $default) { + $match = 'elements.id'; } - if ($node === 'usedefault') { - $match = 'elements.id'; + if (is_array($value)) { + $value = $value[0]; } if ($match === 'fullName') { diff --git a/src/elements/User.php b/src/elements/User.php index 47ff9e55..b29f2d1d 100644 --- a/src/elements/User.php +++ b/src/elements/User.php @@ -231,6 +231,29 @@ protected function parseGroups($feedData, $fieldInfo): array return $groupIds; } + /** + * Get and validate Preferred Locale attribute + * + * @param $feedData + * @param $fieldInfo + * @return array|\ArrayAccess|mixed|string|null + * @throws \yii\base\Exception + */ + protected function parsePreferredLocale($feedData, $fieldInfo) + { + $value = $this->fetchSimpleValue($feedData, $fieldInfo); + + if ($value === "") { + return $value; + } + + if ($value !== null && in_array($value, Craft::$app->getI18n()->getAppLocaleIds(), true)) { + return $value; + } + + return null; + } + /** * @param $feedData * @param $fieldInfo diff --git a/src/fields/Matrix.php b/src/fields/Matrix.php index d148c4cd..74b7f9af 100644 --- a/src/fields/Matrix.php +++ b/src/fields/Matrix.php @@ -152,6 +152,10 @@ public function parseField(): mixed // Prepare an array that's ready for Matrix to import it $preppedData[$blockIndex . '.type'] = $blockHandle; $preppedData[$blockIndex . '.enabled'] = !$disabled; + // because of PR 1284 and enhanced matrix data comparison in PR 1291, + // we need to add "collapsed => false" to the matrix data from the feed; + // otherwise enhanced matrix data comparison will always think the data has changed + $preppedData[$blockIndex . '.collapsed'] = false; $preppedData[$blockIndex . '.fields.' . $subFieldHandle] = $value; } diff --git a/src/fields/Table.php b/src/fields/Table.php index 7a9434d7..4bfddd3b 100644 --- a/src/fields/Table.php +++ b/src/fields/Table.php @@ -86,6 +86,21 @@ public function parseField(): mixed } } + // fill out default values + foreach ($parsedData as $rowCounter => $row) { + foreach ($columns as $columnHandle => $columnInfo) { + $node = Hash::get($columnInfo, 'node'); + $type = Hash::get($columnInfo, 'type'); + + if ($node === 'usedefault') { + if (!isset($parsedData[$rowCounter][$columnHandle]) && !empty($columnInfo['default'])) { + $parsedValue = $this->_handleSubField($type, $columnInfo['default']); + $parsedData[$rowCounter][$columnHandle] = $parsedValue; + } + } + } + } + $dataDelimiter = Plugin::$plugin->service->getConfig('dataDelimiter', $this->feed['id']); foreach ($parsedData as $rowKey => $row) { @@ -146,9 +161,7 @@ private function _handleSubField($type, $value) } if ($type == 'date') { - $parsedValue = DateTimeHelper::toDateTime($value) ?: null; - - return $this->field->serializeValue($parsedValue); + return DateTimeHelper::toDateTime($value) ?: null; } if ($type == 'lightswitch') { @@ -160,9 +173,7 @@ private function _handleSubField($type, $value) } if ($type == 'time') { - $parsedValue = DateTimeHelper::toDateTime($value) ?: null; - - return $this->field->serializeValue($parsedValue); + return DateTimeHelper::toDateTime($value) ?: null; } // Protect against array values diff --git a/src/helpers/DataHelper.php b/src/helpers/DataHelper.php index 1359aaf9..47e25215 100644 --- a/src/helpers/DataHelper.php +++ b/src/helpers/DataHelper.php @@ -44,7 +44,7 @@ public static function fetchSimpleValue($feedData, $fieldInfo): mixed $value = $feedData[$node] ?? null; // Use the default value for the field-mapping (if defined) - if ($value === null || $value === '') { + if (($value === null || $value === '') && !empty($default)) { $value = $default; } @@ -86,6 +86,12 @@ public static function fetchArrayValue($feedData, $fieldInfo): mixed // Trim values in case whitespace was used between delimiter $delimitedValues = array_map('trim', $delimitedValues); + // we need the value to start as null for setEmptyValues + // but we also need it to be an array at this point so that array_merge doesn't freak out + // so if it's null so far, change it to an empty array as we're about to populate it with data + if ($value === null) { + $value = []; + } $value = array_merge($value, $delimitedValues); } else { $value[] = $nodeValue; @@ -141,7 +147,6 @@ public static function fetchValue($feedData, $fieldInfo, $feed = null): mixed $node = Hash::get($fieldInfo, 'node'); $default = Hash::get($fieldInfo, 'default'); - $dataDelimiter = Plugin::$plugin->service->getConfig('dataDelimiter'); // Some fields require array, or multiple values like Elements, Checkboxes, etc., and we need to parse them differently. @@ -166,6 +171,12 @@ public static function fetchValue($feedData, $fieldInfo, $feed = null): mixed // Trim values in case whitespace was used between delimiter $delimitedValues = array_map('trim', $delimitedValues); + // we need the value to start as null for setEmptyValues + // but we also need it to be an array at this point so that array_merge doesn't freak out + // so if it's null so far, change it to an empty array as we're about to populate it with data + if ($value === null) { + $value = []; + } $value = array_merge($value, $delimitedValues); } else { $value[] = $nodeValue; @@ -173,21 +184,22 @@ public static function fetchValue($feedData, $fieldInfo, $feed = null): mixed } } + // Check if not importing, just using default + if ($node === 'usedefault' && !$value) { + $value = $default; + } + + // if value is still null - return if ($value === null) { return null; } // Help to normalise things if an array with only one item. Probably a better idea to offload this to each - // attribute of field definition, as it's quite an assumption at this point... - if (count($value) === 1) { + // attribute of field definition, as its quite an assumption at this point... + if (is_array($value) && count($value) === 1) { $value = $value[0]; } - // Check if not importing, just using default - if ($node === 'usedefault' && !$value) { - $value = $default; - } - // If setEmptyValues is enabled allow overwriting existing data if ($feed !== null && $value === "" && $feed['setEmptyValues']) { return $value; @@ -260,6 +272,12 @@ public static function compareElementContent($content, $element): ?bool unset($trackedChanges[$key]); continue; } + + // Check for complex fields + if (self::_compareComplexValues($fields, $key, $existingValue, $newValue)) { + unset($trackedChanges[$key]); + continue; + } // Then check for simple attributes $existingValue = Hash::get($attributes, $key); @@ -398,4 +416,70 @@ private static function _compareSimpleValues($fields, $key, $firstValue, $second // Didn't match return false; } + + /** + * Compare values recursively while ignoring property order and null values + * + * @param mixed $firstValue + * @param mixed $secondValue + * @return bool + */ + private static function _recursiveCompare($firstValue, $secondValue): bool + { + if (is_array($firstValue) && is_array($secondValue)) { + // Ignore values that are `null` or empty arrays + $firstValue = array_filter($firstValue, static function($value) { + return !($value === null || $value === []); + }); + $secondValue = array_filter($secondValue, static function($value) { + return !($value === null || $value === []); + }); + + // Both values must have the same keys (ignoring order) + $firstKeys = array_keys($firstValue); + $secondKeys = array_keys($secondValue); + if (count(array_diff($firstKeys, $secondKeys)) || count(array_diff($secondKeys, $firstKeys))) { + return false; + } + + // Each key must be the same value + foreach ($firstValue as $key => $value) { + if (!self::_recursiveCompare($value, $secondValue[$key])) { + return false; + } + } + + return true; + } + + if (is_object($firstValue) && is_object($secondValue)) { + // For now this does not seem relevant + return false; + } + + return $firstValue === $secondValue; + } + + private static function _compareComplexValues($fields, $key, $firstValue, $secondValue): bool + { + // When the values are nested arrays we are probably comparing matrix elements + if (Hash::check($fields, $key) + && is_array($firstValue) + && is_array($secondValue) + && array_reduce($firstValue, static function($carry, $item) { + return $carry && is_array($item); + }, true) + && array_reduce($secondValue, static function($carry, $item) { + return $carry && is_array($item); + }, true) + ) { + // Compare the values recursively while ignoring the keys at the first level, + // these keys are statically set to `'newX'` and the ids for the values in the database + // so they have no meaning here + return self::_recursiveCompare(array_values($firstValue), array_values($secondValue)); + } + + // Didn't match + return false; + } } diff --git a/src/models/Settings.php b/src/models/Settings.php index bcbf8f0e..0016d6ed 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -79,9 +79,9 @@ class Settings extends Model public int $sleepTime = 0; /** - * @var bool + * @var bool|string */ - public bool $logging = true; + public bool|string $logging = true; /** * @var bool diff --git a/src/services/Logs.php b/src/services/Logs.php index 7049df37..490cdafb 100644 --- a/src/services/Logs.php +++ b/src/services/Logs.php @@ -170,7 +170,13 @@ public function getLogEntries($type = null): array */ private function _canLog($type): bool { - $logging = Plugin::$plugin->service->getConfig('logging'); + $loggingConfig = Plugin::$plugin->service->getConfig('logging'); + + // parse the config value because it need to allow for strings too to support 'error' level + $logging = App::parseBooleanEnv($loggingConfig); + if ($logging === null) { + $logging = $loggingConfig; + } // If logging set to false, don't log anything if ($logging === false) { diff --git a/src/services/Process.php b/src/services/Process.php index 3ca6205d..cf6e4bf9 100644 --- a/src/services/Process.php +++ b/src/services/Process.php @@ -5,6 +5,7 @@ use Cake\Utility\Hash; use Craft; use craft\base\Component; +use craft\elements\User; use craft\errors\ShellCommandException; use craft\feedme\base\ElementInterface; use craft\feedme\events\FeedProcessEvent; @@ -275,6 +276,10 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul // If we're deleting or updating an existing element, we want to focus on that one if (DuplicateHelper::isUpdate($feed)) { + if (method_exists($this->_service, 'checkPropagation')) { + $existingElement = $this->_service->checkPropagation($existingElement, $feed); + } + $element = clone $existingElement; // Update our service with the correct element @@ -474,6 +479,15 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul // Save the element if ($this->_service->save($element, $feed)) { + + // save user's preferences only after user has been successfully saved + if ($element instanceof User && isset($attributeData['preferredLocale'])) { + if (!empty($attributeData['preferredLocale']) || $feed['setEmptyValues'] === 1) { + $preferences = ['locale' => $attributeData['preferredLocale']]; + Craft::$app->getUsers()->saveUserPreferences($element, $preferences); + } + } + // Give elements a chance to perform actions after save $this->_service->afterSave($contentData, $feed); diff --git a/src/templates/_includes/elements/categories/map.html b/src/templates/_includes/elements/categories/map.html index 8ce69264..60d40800 100644 --- a/src/templates/_includes/elements/categories/map.html +++ b/src/templates/_includes/elements/categories/map.html @@ -7,11 +7,6 @@ {% set group = craft.app.categories.getGroupById(groupId) %} {% endif %} -{% set categories = [{ label: 'Don’t import'|t('feed-me'), value: '' }] %} -{% for category in craft.categories({ groupId: groupId }).all() %} - {% set categories = categories|merge([{ label: category.title|slice(0, 40), value: category.id }]) %} -{% endfor %} - {% set fields = [{ name: 'Title', handle: 'title', @@ -31,8 +26,13 @@ handle: 'parent', instructions: 'Select a parent category to import these categories under.'|t('feed-me'), default: { - type: 'select', - options: categories, + type: 'elementselect', + options: { + elementType: 'craft\\elements\\Category', + sources: ['group:' ~ group.uid], + selectionLabel: "Default Parent"|t('feed-me'), + limit: 1, + }, }, }, { name: 'Status', diff --git a/src/templates/_includes/elements/commerce-products/map.html b/src/templates/_includes/elements/commerce-products/map.html index 2580edba..bfb844d9 100644 --- a/src/templates/_includes/elements/commerce-products/map.html +++ b/src/templates/_includes/elements/commerce-products/map.html @@ -32,6 +32,7 @@ type: 'text', }, }, { + type: 'date', name: 'Post Date', handle: 'postDate', instructions: 'Accepts Unix timestamp, or just about any English textual datetime description.'|t('feed-me'), @@ -39,6 +40,7 @@ type: 'dateTime', }, }, { + type: 'date', name: 'Expiry Date', handle: 'expiryDate', instructions: 'Accepts Unix timestamp, or just about any English textual datetime description.'|t('feed-me'), diff --git a/src/templates/_includes/elements/entries/map.html b/src/templates/_includes/elements/entries/map.html index cc2ccb69..cb7cd06a 100644 --- a/src/templates/_includes/elements/entries/map.html +++ b/src/templates/_includes/elements/entries/map.html @@ -27,22 +27,21 @@ {# If a structure, provide the option for a parent #} {% if section.type == 'structure' %} - {% set entries = [{ label: 'Don’t import'|t('feed-me'), value: '' }] %} - - {% for entry in craft.entries({ sectionId: sectionId }).all() %} - {% set entries = entries|merge([{ label: entry.title|slice(0, 40), value: entry.id }]) %} - {% endfor %} - - {% set fields = fields|merge([{ + {% set fields = fields|push({ type: 'entries', name: 'Parent', handle: 'parent', instructions: 'Select a parent entry to import these entries under.'|t('feed-me'), default: { - type: 'select', - options: entries, + type: 'elementselect', + options: { + elementType: 'craft\\elements\\Entry', + sources: ['section:' ~ section.uid], + selectionLabel: "Default Parent"|t('feed-me'), + limit: 1, + }, }, - }]) %} + }) %} {% endif %} {% set fields = fields|merge([{ diff --git a/src/templates/_includes/fields/_base.html b/src/templates/_includes/fields/_base.html index f8a4fadb..2c050ee1 100644 --- a/src/templates/_includes/fields/_base.html +++ b/src/templates/_includes/fields/_base.html @@ -138,6 +138,20 @@ options: default.options, }) }} + {% elseif default.type == 'date' %} + + {{ forms.dateField({ + name: 'default', + value: craft.feedme.formatDateTime(defaultValue), + }) }} + + {% elseif default.type == 'time' %} + + {{ forms.timeField({ + name: 'default', + value: craft.feedme.formatDateTime(defaultValue), + }) }} + {% elseif default.type == 'dateTime' %} {{ forms.dateTimeField({ diff --git a/src/templates/_includes/fields/table.html b/src/templates/_includes/fields/table.html index d10643db..7d5abdaf 100644 --- a/src/templates/_includes/fields/table.html +++ b/src/templates/_includes/fields/table.html @@ -36,12 +36,35 @@ +{% set colTypeMappings = { + 'checkbox': 'checkbox', + 'color': 'text', + 'date': 'date', + 'select': 'select', + 'email': 'text', + 'lightswitch': 'lightswitch', + 'multiline': 'text', + 'number': 'text', + 'singleline': 'text', + 'time': 'time', + 'url': 'text', +} %} + {% for index, col in field.settings.columns %} {% set nameLabel = col.heading %} {% set instructionsHandle = handle ~ '[' ~ col.handle ~ ']' %} {% set path = prefixPath|merge ([ 'fields', index ]) %} + {% if colTypeMappings[col.type] is defined %} + {% set default = { + type: colTypeMappings[col.type], + } %} + {% if colTypeMappings[col.type] == 'select' %} + {% set default = default|merge({options: col.options}) %} + {% endif %} + {% endif %} + {% embed 'feed-me/_includes/fields/_base' %} {% block additionalFieldSettings %} {% namespace 'fieldMapping[' ~ path|join('][') ~ ']' %}