feed-me
feed-me copied to clipboard
Empty feed does not disable/delete existing elements
Description
When a feed has "Disable/delete missing elements" enabled and the processed feed is empty no elements are disabled/deleted.
Steps to reproduce
- Feed with Disable/delete missing elements
- Run feed without results.
Additional info
I believe the following lines in the afterProcessFeed function in the Process service are responsible.
In this case $processedElementIds
is an empty array.
if ($processedElementIds) {
$elementsToDeleteDisable = array_diff($settings['existingElements'], $processedElementIds);
if ($elementsToDeleteDisable) {
if (DuplicateHelper::isDisable($feed)) {
$this->_service->disable($elementsToDeleteDisable);
$message = 'The following elements have been disabled: ' . Json::encode($elementsToDeleteDisable) . '.';
} elseif (DuplicateHelper::isDisableForSite($feed)) {
$this->_service->disableForSite($elementsToDeleteDisable);
$message = 'The following elements have been disabled for the target site: ' . Json::encode($elementsToDeleteDisable) . '.';
} else {
$this->_service->delete($elementsToDeleteDisable);
$message = 'The following elements have been deleted: ' . Json::encode($elementsToDeleteDisable) . '.';
}
Plugin::info($message);
Plugin::debug($message);
}
}
- Craft version: 4.5.3
- PHP version: 8.1
- Database driver & version: MySQL 5.7
- Plugins & versions: Feed me 5.2.0
Just found out the same issue. Would be a nice feature to delete all entries if the data is empty. Weird it doesn't work like that out of the box.
Also discovered this just now.
I would have thought the process would just take from settings e.g. if you chose to delete missing entries, then an empty feed will delete all missing entries ... same for disable.
We've just run into this issue too.
It would be good to know if there's an intention to fix this bug, or if we need to consider a workaround solution for the future.
Currently running into the same issue that missing entries don't get disabled when the feed is empty.
Any update on this?
Also having this issue in Craft 5 and Feed me 6.1.0.