You are here

public function NodeRevisionDeleteCommands::lastExecute in Node Revision Delete 8

Get the last time that the node revision delete was made.

@usage nrd-last-execute Show the last time that the node revision delete was made.

@command nrd:last-execute @aliases nrd-le, nrd-last-execute

File

src/Commands/NodeRevisionDeleteCommands.php, line 157

Class

NodeRevisionDeleteCommands
Class NodeRevisionDeleteCommands.

Namespace

Drupal\node_revision_delete\Commands

Code

public function lastExecute() {

  // Getting the value.
  $last_execute = $this->state
    ->get('node_revision_delete.last_execute', 0);
  if (!empty($last_execute)) {
    $last_execute = $this->dateFormatter
      ->format($last_execute);
    $message = dt('<info>The last time when node revision delete was made was: @last_execute.</info>', [
      '@last_execute' => $last_execute,
    ]);
  }
  else {
    $message = dt('<info>The removal of revisions through the module node revision delete has never been executed on this site.</info>');
  }
  $this
    ->writeln($message);
}