From b4ad8e3314dc7919084c46a350ba6c981141e652 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Tue, 11 Jun 2024 09:31:29 -0400 Subject: [PATCH 1/2] Account for backupCommand === false --- src/services/Process.php | 5 +++++ src/templates/feeds/_edit.html | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/services/Process.php b/src/services/Process.php index 57e795c9..ccdf3800 100644 --- a/src/services/Process.php +++ b/src/services/Process.php @@ -644,6 +644,11 @@ public function debugFeed($feed, $limit, $offset, $processedElementIds): void */ private function _backupBeforeFeed($feed): void { + if (Craft::$app->getConfig()->getGeneral()->backupCommand === false) { + Plugin::info('Database not backed up because the backup command is false.'); + return; + } + $logKey = StringHelper::randomString(20); $limit = Plugin::$plugin->service->getConfig('backupLimit', $feed['id']); diff --git a/src/templates/feeds/_edit.html b/src/templates/feeds/_edit.html index ec48800d..ea5296c5 100644 --- a/src/templates/feeds/_edit.html +++ b/src/templates/feeds/_edit.html @@ -21,6 +21,7 @@ {% set title = (feed.id) ? feed.name : 'Create a new feed'|t('feed-me') %} {% set noTabs = true %} {% set fullPageForm = true %} +{% set backupsDisabled = craft.app.config.general.backupCommand is same as(false) %} {% set buttons %}
@@ -206,6 +207,9 @@

{{ 'Import strategy'|t('feed-me') }}

instructions: 'Perform a full backup each time this feed is processed.'|t('feed-me'), name: 'backup', on: (feed.id) ? feed.backup : true, + containerAttributes: backupsDisabled ? {class: ['disabled']} : {}, + tip: backupsDisabled ? 'Backups are disabled while the backup command is `false`.'|t('feed-me'), + disabled: backupsDisabled, }) }} {{ forms.lightswitchField({ From 80329c89467a5307e825496d643a0f34086ee144 Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Tue, 11 Jun 2024 10:09:37 -0700 Subject: [PATCH 2/2] changelog for https://github.com/craftcms/feed-me/pull/1461 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ceda5ddc..e26640f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Feed Me +## Unreleased + +- Fixed an error that would occur when running a feed with the backup database setting enabled, when Craft's `backupCommand` was set to false. ([#1461](https://github.com/craftcms/feed-me/pull/1461)) + ## 5.5.0 - 2024-05-26 - You can now match elements in a feed via their Asset IDs, instead of just the filename. ([#1327](https://github.com/craftcms/feed-me/pull/1327))