You are here

class Cron in Organic groups 8

Performs a cron deletion of orphans.

Plugin annotation


@OgDeleteOrphans(
 id = "cron",
 label = @Translation("Cron", context = "OgDeleteOrphans"),
 description = @Translation("The deletion is done in the background during cron. Best overall solution but requires cron to run regularly."),
)

Hierarchy

Expanded class hierarchy of Cron

File

src/Plugin/OgDeleteOrphans/Cron.php, line 19

Namespace

Drupal\og\Plugin\OgDeleteOrphans
View source
class Cron extends OgDeleteOrphansBase implements QueueWorkerInterface {

  /**
   * {@inheritdoc}
   */
  public function process() {

    // No online processing is done in this plugin. Instead, all orphans are
    // deleted during offline cron jobs by the DeleteOrphan queue worker.
    // @see \Drupal\og\Plugin\QueueWorker\DeleteOrphan
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {

    // Orphans are processed one by one by the QueueWorker during cron runs
    // until the alotted time expires.
    // @see \Drupal\og\Plugin\QueueWorker\DeleteOrphan
    $this
      ->deleteOrphan($data['type'], $data['id']);
  }

  /**
   * {@inheritdoc}
   */
  protected function getQueue() {

    // By design, every QueueWorker is executed on every cron run and will
    // start processing its designated queue. To make sure that our DeleteOrphan
    // queue worker will not start processing orphans that have been registered
    // by another plugin (e.g. the Batch plugin) we are using a dedicated queue.
    return $this->queueFactory
      ->get('og_orphaned_group_content_cron', TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Cron::getQueue protected function Returns the queue of orphans to delete. Overrides OgDeleteOrphansBase::getQueue
Cron::process public function Starts the deletion process. Overrides OgDeleteOrphansInterface::process
Cron::processItem public function Works on a single queue item. Overrides QueueWorkerInterface::processItem
OgDeleteOrphansBase::$entityTypeManager protected property The entity type manager.
OgDeleteOrphansBase::$groupAudienceHelper protected property The OG group audience helper.
OgDeleteOrphansBase::$membershipManager protected property The OG membership manager.
OgDeleteOrphansBase::$queueFactory protected property The queue factory.
OgDeleteOrphansBase::configurationForm public function Returns the configuration form elements specific to this plugin. Overrides OgDeleteOrphansInterface::configurationForm 1
OgDeleteOrphansBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
OgDeleteOrphansBase::deleteOrphan protected function Deletes an orphaned group content entity if it is fully orphaned.
OgDeleteOrphansBase::query protected function Queries the registered group entity for orphaned members to delete.
OgDeleteOrphansBase::register public function Registers a soon to be deleted group entity, for processing. Overrides OgDeleteOrphansInterface::register 1
OgDeleteOrphansBase::__construct public function Constructs an OgDeleteOrphansBase object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.