diff core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php	Thu Feb 28 13:11:55 2019 +0000
@@ -0,0 +1,37 @@
+<?php
+
+namespace Drupal\TestSite\Commands;
+
+use Drupal\Core\Test\TestDatabase;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Command to release all test site database prefix locks.
+ *
+ * Note that this command can't be safely tested by DrupalCI without potentially
+ * causing random failures.
+ *
+ * @internal
+ */
+class TestSiteReleaseLocksCommand extends Command {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    $this->setName('release-locks')
+      ->setDescription('Releases all test site locks')
+      ->setHelp('The locks ensure test site database prefixes are not reused.');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+    TestDatabase::releaseAllTestLocks();
+    $output->writeln('<info>Successfully released all the test database locks</info>');
+  }
+
+}