You are here

class GatsbyFastbuildsCommands in Gatsby Live Preview & Incremental Builds 8

Same name and namespace in other branches
  1. 2.0.x modules/gatsby_fastbuilds/src/Commands/GatsbyFastbuildsCommands.php \Drupal\gatsby_fastbuilds\Commands\GatsbyFastbuildsCommands

A drush command file.

@package Drupal\gatsby_fastbuilds\Commands

Hierarchy

Expanded class hierarchy of GatsbyFastbuildsCommands

1 string reference to 'GatsbyFastbuildsCommands'
drush.services.yml in modules/gatsby_fastbuilds/drush.services.yml
modules/gatsby_fastbuilds/drush.services.yml
1 service uses GatsbyFastbuildsCommands
gatsby_fastbuilds.commands in modules/gatsby_fastbuilds/drush.services.yml
\Drupal\gatsby_fastbuilds\Commands\GatsbyFastbuildsCommands

File

modules/gatsby_fastbuilds/src/Commands/GatsbyFastbuildsCommands.php, line 14

Namespace

Drupal\gatsby_fastbuilds\Commands
View source
class GatsbyFastbuildsCommands extends DrushCommands {

  /**
   * Drupal\gatsby_fastbuilds\GatsbyEntityLogger definition.
   *
   * @var \Drupal\gatsby_fastbuilds\GatsbyEntityLogger
   */
  protected $gatsbyLogger;

  /**
   * Drupal\Core\State\StateInterface definition.
   *
   * @var \Drupal\State\State\StateInterface
   */
  protected $state;

  /**
   * Constructs a new GatsbyFastbuildsCommands object.
   */
  public function __construct(GatsbyEntityLogger $gatsby_logger, StateInterface $state) {
    parent::__construct();
    $this->gatsbyLogger = $gatsby_logger;
    $this->state = $state;
  }

  /**
   * Drush command that deletes all the Gatsby Fastbuilds Log entries.
   *
   * @command gatsby_fastbuilds:delete
   * @aliases gatsdel
   * @usage gatsby_fastbuilds:delete
   */
  public function delete() {
    $time = time();
    $this->gatsbyLogger
      ->deleteExpiredLoggedEntities($time);

    // Store the log time in order to validate future syncs.
    $this->state
      ->set('gatsby_fastbuilds.last_logtime', $time);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GatsbyFastbuildsCommands::$gatsbyLogger protected property Drupal\gatsby_fastbuilds\GatsbyEntityLogger definition.
GatsbyFastbuildsCommands::$state protected property Drupal\Core\State\StateInterface definition.
GatsbyFastbuildsCommands::delete public function Drush command that deletes all the Gatsby Fastbuilds Log entries.
GatsbyFastbuildsCommands::__construct public function Constructs a new GatsbyFastbuildsCommands object.