Skip to content

Commit 8354eba

Browse files
committed
Merge branch '5.x' into 6.x
2 parents 664c4db + aa6241c commit 8354eba

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Fixed a bug that could occur when saving empty ("") values if `compareContent` and “Set Empty Values” were both enabled. ([#1621](https://github.com/craftcms/feed-me/pull/1621))
1111
- Fixed a bug that could occur when importing into a Matrix field with no blocks. ([#1622](https://github.com/craftcms/feed-me/pull/1622))
1212
- Fixed a regression that happened in 5.3.0 where imports into relational field would not remove existing relations if it was required. ([#1623](https://github.com/craftcms/feed-me/pull/1623))
13+
- Fixed a regression where `EVENT_BEFORE_PROCESS_FEED` was called once per batch and not once per page. ([#1628](https://github.com/craftcms/feed-me/pull/1628))
1314

1415
## 6.8.0 - 2025-03-14
1516
-

src/queue/jobs/FeedImport.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,6 @@ protected function loadData(): Batchable
119119

120120
$data = array_values($data);
121121

122-
// Fire an 'onBeforeProcessFeed' event
123-
$event = new FeedProcessEvent([
124-
'feed' => $this->feed,
125-
'feedData' => $data,
126-
]);
127-
128-
Plugin::$plugin->process->trigger(Process::EVENT_BEFORE_PROCESS_FEED, $event);
129-
130-
if (!$event->isValid) {
131-
return new DataBatcher([]);
132-
}
133-
134-
// Allow event to modify the feed data
135-
$data = $event->feedData;
136-
137122
return new DataBatcher($data);
138123
}
139124

@@ -169,8 +154,23 @@ public function execute($queue): void
169154
Plugin::info('No feed items to process.');
170155
return;
171156
}
172-
157+
173158
if ($this->itemOffset == 0) {
159+
// Fire an 'onBeforeProcessFeed' event
160+
$event = new FeedProcessEvent([
161+
'feed' => $this->feed,
162+
'feedData' => $data,
163+
]);
164+
165+
Plugin::$plugin->process->trigger(Process::EVENT_BEFORE_PROCESS_FEED, $event);
166+
167+
if (!$event->isValid) {
168+
return;
169+
}
170+
171+
// Allow event to modify the feed data
172+
$data = $event->feedData;
173+
174174
$processService->beforeProcessFeed($this->feed, $data);
175175
}
176176

0 commit comments

Comments
 (0)