diff --git a/docs/en/userguide/index.md b/docs/en/userguide/index.md index 6ef3d66..719cc63 100644 --- a/docs/en/userguide/index.md +++ b/docs/en/userguide/index.md @@ -30,9 +30,9 @@ and previous reviews in the same view, but cannot change anything. ## Disable for pre-prod environments -The sending of emails can be disabled for pre-production environments. This may be needed if a production database is restored to a UAT environment. +The sending of emails can be disabled. This feature may be needed for example, if a production database is restored to a UAT environment. ``` SilverStripe\ContentReview\Tasks\ContentReviewEmails: - disablePreProd: true + send_emails: false ``` diff --git a/src/Tasks/ContentReviewEmails.php b/src/Tasks/ContentReviewEmails.php index 776e65d..92c3ee5 100644 --- a/src/Tasks/ContentReviewEmails.php +++ b/src/Tasks/ContentReviewEmails.php @@ -4,7 +4,6 @@ namespace SilverStripe\ContentReview\Tasks; use Page; use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability; -use SilverStripe\Control\Director; use SilverStripe\Control\Email\Email; use SilverStripe\Control\HTTPRequest; use SilverStripe\Dev\BuildTask; @@ -22,15 +21,16 @@ use SilverStripe\View\SSViewer; */ class ContentReviewEmails extends BuildTask { - private static $disablePreProd = false; + private static $send_emails = true; + /** * @param HTTPRequest $request */ public function run($request) { - // If the $disablePreProd static has been set to true, don't run the task - if (!Director::isLive() && $this->config()->get('disablePreProd')) { - echo 'The Content review task has been disabled for pre-prod environments'; + // If the $send_emails static has been set to false, don't run the task + if (!$this->config()->get('send_emails')) { + echo 'The Content review task has been disabled'; exit; }