From b09790f1fb5ca80bbdc463e3ff861c8484ae9798 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 18 May 2020 08:39:09 +0100 Subject: [PATCH 1/3] Updates readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8014efc..be55532 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- + Enupal Backup

@@ -40,7 +40,7 @@ Fully integrated Backup solution for Craft CMS ## Documentation -https://enupal.com/craft-plugins/enupal-backup/docs/ +https://docs.enupal.com/enupal-backup/ ## Enupal Backup Support From 619775be3d56be58f7af9cd0cdcacaee6f6785f7 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 24 Jun 2020 20:33:37 +0100 Subject: [PATCH 2/3] Removes manually call queue->run() #29 --- src/services/Backups.php | 52 +--------------------------- src/templates/settings/general.twig | 12 ------- src/templates/settings/schedule.twig | 6 ++-- src/variables/BackupVariable.php | 5 +++ 4 files changed, 10 insertions(+), 65 deletions(-) diff --git a/src/services/Backups.php b/src/services/Backups.php index 5453492..54e3351 100644 --- a/src/services/Backups.php +++ b/src/services/Backups.php @@ -85,58 +85,9 @@ public function executeEnupalBackup() // Add our CreateBackup job to the queue Craft::$app->queue->push(new CreateBackup()); - if (Backup::$app->settings->isWindows()) { - if (Craft::$app->getRequest()->isSiteRequest) { - Craft::$app->getQueue()->run(); - $response['message'] = 'running'; - } - } else { - // if is Linux try to call queue/run - if ($settings->runJobInBackground){ - $this->runQueueInBackground(); - }else{ - Craft::$app->getQueue()->run(); - } - $response['message'] = 'running'; - } - return $response; } - /** - * @return bool - */ - public function runQueueInBackground() - { - $success = false; - $settings = Backup::$app->settings->getSettings(); - if (!Backup::$app->settings->isWindows()) { - $shellCommand = new ShellCommand(); - // We have better error messages with exec - if (function_exists('exec') && $settings->useExec) { - $shellCommand->captureStdErr = false; - Craft::info('useExec is enabled on running the queue on background', __METHOD__); - $shellCommand->useExec = true; - } - $craftPath = CRAFT_BASE_PATH; - $phpPath = Backup::$app->backups->getPhpPath(); - - $command = 'cd' . - ' ' . $craftPath; - $command .= ' && ' . $phpPath . - ' ./craft' . - ' queue/run'; - //$command .= ' > /dev/null 2>&1 &'; - - Craft::info('Queue Command: ' . $command, __METHOD__); - $shellCommand->setCommand($command); - $success = $shellCommand->execute(); - Craft::info('Queue Command Result: ' . $success, __METHOD__); - } - - return $success; - } - /** * @return array */ @@ -344,7 +295,7 @@ public function installDefaultValues() $primarySiteUrl = Craft::getAlias($primarySite['baseUrl']); - $settings['primarySiteUrl'] = $primarySiteUrl; + $settings['primarySiteUrl'] = Craft::parseEnv(Craft::getAlias(rtrim(trim($primarySiteUrl), "/")));; Craft::$app->getPlugins()->savePluginSettings(Backup::getInstance(), $settings); } @@ -493,7 +444,6 @@ public function processPendingBackups() if ($pendingBackups) { $checkPendingBackups->pendingBackups = $pendingBackups; Craft::$app->queue->push($checkPendingBackups); - Craft::$app->queue->run(); } } diff --git a/src/templates/settings/general.twig b/src/templates/settings/general.twig index 38062f7..8948b4c 100644 --- a/src/templates/settings/general.twig +++ b/src/templates/settings/general.twig @@ -87,18 +87,6 @@ errors: settings.getErrors('primarySiteUrl') }) }} -
- {{ forms.lightswitchField({ - label: "Run Backup job in Background"|t('enupal-backup'), - instructions: 'Enable this setting for heavy backups', - id: 'runJobInBackground', - name: 'runJobInBackground', - on: settings.runJobInBackground, - toggle: 'settings-runJobInBackground', - onLabel: "On"|t('enupal-backup'), - offLabel: "Off"|t('enupal-backup') - }) }} -
{{ forms.lightswitchField({ label: "Use exec"|t('enupal-backup'), diff --git a/src/templates/settings/schedule.twig b/src/templates/settings/schedule.twig index 91789a8..fab86cf 100644 --- a/src/templates/settings/schedule.twig +++ b/src/templates/settings/schedule.twig @@ -13,6 +13,7 @@ {% set settings = craft.enupalbackup.getSettings() %} {% set fullPageForm = true %} {% set saveShortcutRedirect = 'enupal-backup/settings/schedule' %} +{% set craftPath = craft.enupalbackup.getCraftPath() %} {% set saveButton %}
@@ -31,7 +32,7 @@ {% namespace 'settings' %} {{ forms.field({ label: "Webhook"|t('enupal-backup')|upper, - instructions: "Enupal Backup provides you a webhook to schedule your backups, here is an example how to do it with Cron. Adding one of the following lines to your crontab will execute your backup every morning at 3:10 AM."|t('enupal-backup'), + instructions: "Enupal Backup provides you a webhook to schedule your backups, here is an example how to do it with Cron. Adding one of the following lines to your crontab will execute your backup every morning at 3:11 AM."|t('enupal-backup'), }, null) }}
@@ -78,7 +79,8 @@ # * * * * * # Enupal Backup Webhook -10 3 * * * wget {{webhookUrl}} -O /dev/null +10 3 * * * curl --request GET '{{webhookUrl}}' +11 3 * * * cd {{ craftPath }} && php craft queue/run
diff --git a/src/variables/BackupVariable.php b/src/variables/BackupVariable.php index b118521..2355c87 100644 --- a/src/variables/BackupVariable.php +++ b/src/variables/BackupVariable.php @@ -137,5 +137,10 @@ public function processPendingBackups() { Backup::$app->backups->processPendingBackups(); } + + public function getCraftPath() + { + return CRAFT_BASE_PATH; + } } From bbae236fd8a0a19f140c3980a9273827cfe37b59 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 24 Jun 2020 20:49:14 +0100 Subject: [PATCH 3/3] Adds v1.5.0 --- CHANGELOG.md | 10 ++++++++++ composer.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 172fa96..02bbd86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Enupal Backup Changelog +## 1.5.0 - 2020.06.24 + +> {tip} This release fixes an issue with Amazon SQS queue service, if you have scheduled backups via Webhook you need to add an additional cronjob, instructions under Enupal Backup -> Settings -> Schedule [docs](https://docs.enupal.com/enupal-backup/schedule/webhook.html). We recommend update to this version as the performance is improved. Enjoy! + +### Fixed + - Fixed issue with Amazon SQS queue service + + ### Removed + - Removed "Run job in background" setting + ## 1.4.0 - 2020.03.24 ### Added - Added support for Craft CMS 3.4.x diff --git a/composer.json b/composer.json index 51838d2..9fd14ff 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "enupal/backup", "description": "Fully integrated Backup solution for Craft CMS", "type": "craft-plugin", - "version": "1.4.0", + "version": "1.5.0", "keywords": [ "craft", "cms",