Terraformers\EmbargoExpiry\Extension\EmbargoExpiryExtension
Class WorkflowEmbargoExpiryExtension
Synopsis
class EmbargoExpiryExtension
extends DataExtension
implements
PermissionProvider
{
- // constants
- const PERMISSION_ADD = 'AddEmbargoExpiry';
- const PERMISSION_REMOVE = 'RemoveEmbargoExpiry';
- const JOB_TYPE_PUBLISH = 'publish';
- const JOB_TYPE_UNPUBLISH = 'unpublish';
- // members
- private static array $db = ;
- private static array $has_one = ;
- public bool $isPublishJobRunning = false;
- public bool $isUnPublishJobRunning = false;
- // methods
- public void updateCMSFields()
- public ValidationResult validate()
- public void updateCMSActions()
- public array providePermissions()
- public void onBeforeWrite()
- public void updateStatusFlags()
- public bool|null canEdit()
- public bool|null canPublish()
- public bool checkAddPermission()
- public bool checkRemovePermission()
- public void unlinkPublishJobAndDate()
- public void unlinkUnPublishJobAndDate()
- public void clearPublishJob()
- public void clearUnPublishJob()
- public int getDesiredPublishDateAsTimestamp()
- public int getPublishOnDateAsTimestamp()
- public int getDesiredUnPublishDateAsTimestamp()
- public int getUnPublishOnDateAsTimestamp()
- public void ensurePublishJob()
- public void ensureUnPublishJob()
- public bool objectRequiresPublishJob()
- public bool objectRequiresUnPublishJob()
- public bool datesAreSequential()
- public void createOrUpdatePublishJob()
- public void createOrUpdateUnPublishJob()
- public bool getIsPublishScheduled()
- public bool getIsUnPublishScheduled()
- public bool isEditable()
- public void addDesiredDateFields()
- public void addScheduledDateFields()
- public null|string getEmbargoExpiryFieldNoticeMessage()
- public void addNoticeOrWarningFields()
- public array getEmbargoExpiryNoticeFieldConditions()
- public string getEmbargoExpiryNoticeMessage()
- public bool getIsPublishJobRunning()
- public void setIsPublishJobRunning()
- public bool getIsUnPublishJobRunning()
- public void setIsUnPublishJobRunning()
- private void updatePublishOnDate()
- private void updateUnPublishOnDate()
- public void prePublishTargetJob()
- public void preUnPublishTargetJob()
- public void updatePublishTargetJobOptions()
- public void updateUnPublishTargetJobOptions()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Implements
- SilverStripe\Security\PermissionProvider
Tasks
Line | Task |
---|---|
227 | need to move these into badges so that we don't have to remove these messages. |
605 | There is a PR on QueuedJobs to use injectable. Should update this once that goes through. |
656 | There is a PR on QueuedJobs to use injectable. Should update this once that goes through. |
Constants
Name | Value |
---|---|
PERMISSION_ADD | 'AddEmbargoExpiry' |
PERMISSION_REMOVE | 'RemoveEmbargoExpiry' |
JOB_TYPE_PUBLISH | 'publish' |
JOB_TYPE_UNPUBLISH | 'unpublish' |
Members
private
- $db — array
- $has_one — array
public
- $isPublishJobRunning
—
Terraformers\EmbargoExpiry\Extension\bool
Property used to track when a DataObject is being accessed during a PublishTargetJob. - $isUnPublishJobRunning
—
Terraformers\EmbargoExpiry\Extension\bool
Property used to track when a DataObject is being accessed during a UnPublishTargetJob.
Methods
private
public
- addDesiredDateFields()
- addNoticeOrWarningFields()
- addScheduledDateFields()
- canEdit() — Add edit check for when publishing has been scheduled and if any workflow definitions want the item to be disabled.
- canPublish() — Add edit check for when publishing has been scheduled and if any workflow definitions want the item to be disabled.
- checkAddPermission()
- checkRemovePermission()
- clearPublishJob() — Clears any existing publish job against this DataObject (unless they are in the process of being completed).
- clearUnPublishJob() — Clears any existing unpublish job against this DataObject (unless they are in the process of being completed).
- createOrUpdatePublishJob()
- createOrUpdateUnPublishJob()
- datesAreSequential()
- ensurePublishJob() — Ensure the existence (or removal) of a publish job at the specified time.
- ensureUnPublishJob() — Ensure the existence (or removal) of an unpublish job at the specified time.
- getDesiredPublishDateAsTimestamp()
- getDesiredUnPublishDateAsTimestamp()
- getEmbargoExpiryFieldNoticeMessage()
- getEmbargoExpiryNoticeFieldConditions()
- getEmbargoExpiryNoticeMessage()
- getIsPublishJobRunning() — Method to decide whether or not this Object is being accessed while a PublishTargetJob is running.
- getIsPublishScheduled() — Returns whether a publishing date has been set and is after the current date
- getIsUnPublishJobRunning() — Method to decide whether or not this Object is being accessed while a PublishTargetJob is running.
- getIsUnPublishScheduled() — Returns whether an unpublishing date has been set and is after the current date
- getPublishOnDateAsTimestamp()
- getUnPublishOnDateAsTimestamp()
- isEditable() — Default logic for whether or not the DataObject is editable. Feel free to override this method on your DataObject if you need to change the logic.
- objectRequiresPublishJob()
- objectRequiresUnPublishJob()
- onBeforeWrite()
- prePublishTargetJob() — A method that can be implemented on your DataObject. This method is run with invokeWithExtensions prior to calling publishRecursive() in the PublishTargetJob.
- preUnPublishTargetJob() — A method that can be implemented on your DataObject. This method is run with invokeWithExtensions prior to calling doUnpublish() in the PublishTargetJob.
- providePermissions()
- setIsPublishJobRunning()
- setIsUnPublishJobRunning()
- unlinkPublishJobAndDate() — When a Job is in the process of running, we want to unlink it from the DataObject before we save, but we don't want to delete the Job itself (otherwise it won't be able to mark itself as complete).
- unlinkUnPublishJobAndDate() — When a Job is in the process of running, we want to unlink it from the DataObject before we save, but we don't want to delete the Job itself (otherwise it won't be able to mark itself as complete).
- updateCMSActions()
- updateCMSFields()
- updatePublishTargetJobOptions() — A method that can be implemented on your DataObject. This method is run with invokeWithExtensions prior to creation of the PublishTargetJob.
- updateStatusFlags() — Add badges to the site tree view to show that a page has been scheduled for publishing or unpublishing
- updateUnPublishTargetJobOptions() — A method that can be implemented on your DataObject. This method is run with invokeWithExtensions prior to creation of the PublishTargetJob.
- validate() — If this Object requires sequential embargo/expiry dates, then let's make sure it has that.