Allow to disable on pre-prod environments
This commit is contained in:
parent
179e9d0cf2
commit
14d19cc282
|
@ -27,3 +27,12 @@ CMS users without the permission to change the content review schedule can still
|
|||
and previous reviews in the same view, but cannot change anything.
|
||||
|
||||
![Read only view of page content review settings](_images/content-review-settings-ro.png)
|
||||
|
||||
## 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.
|
||||
|
||||
```
|
||||
SilverStripe\ContentReview\Tasks\ContentReviewEmails:
|
||||
disablePreProd: true
|
||||
```
|
||||
|
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
@ -15,18 +16,24 @@ use SilverStripe\Security\Member;
|
|||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\View\ArrayData;
|
||||
use SilverStripe\View\SSViewer;
|
||||
use SilverStripe\ContentReview\Models\ContentReviewLog;
|
||||
|
||||
/**
|
||||
* Daily task to send emails to the owners of content items when the review date rolls around.
|
||||
*/
|
||||
class ContentReviewEmails extends BuildTask
|
||||
{
|
||||
private static $disablePreProd = false;
|
||||
/**
|
||||
* @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';
|
||||
exit;
|
||||
}
|
||||
|
||||
$compatibility = ContentReviewCompatability::start();
|
||||
|
||||
// First grab all the pages with a custom setting
|
||||
|
|
Loading…
Reference in New Issue