From 7ea2c8991c18431f62c9a30af3aeb51bd1775e9b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 10 Feb 2021 21:24:41 +0000 Subject: [PATCH] Remove unused export command --- web/modules/custom/blog/drush.services.yml | 6 --- ...ExportBodyValuesForThemePurgingCommand.php | 49 ------------------- 2 files changed, 55 deletions(-) delete mode 100644 web/modules/custom/blog/drush.services.yml delete mode 100644 web/modules/custom/blog/src/Command/ExportBodyValuesForThemePurgingCommand.php diff --git a/web/modules/custom/blog/drush.services.yml b/web/modules/custom/blog/drush.services.yml deleted file mode 100644 index 5a4a328..0000000 --- a/web/modules/custom/blog/drush.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - Drupal\opdavies_blog\Command\ExportBodyValuesForThemePurgingCommand: - arguments: ['@database'] - autowire: true - tags: - - { name: drush.command } diff --git a/web/modules/custom/blog/src/Command/ExportBodyValuesForThemePurgingCommand.php b/web/modules/custom/blog/src/Command/ExportBodyValuesForThemePurgingCommand.php deleted file mode 100644 index fea9a3d..0000000 --- a/web/modules/custom/blog/src/Command/ExportBodyValuesForThemePurgingCommand.php +++ /dev/null @@ -1,49 +0,0 @@ -database = $database; - } - - /** - * Drush command to export body field values into a file. - * - * @command opdavies:export-body-values-for-theme-purging - */ - public function handle(): void { - $values = Collection::make(self::$tableNames) - ->flatMap(fn(string $tableName) => $this->getValuesFromTable($tableName)) - ->implode(PHP_EOL); - - file_put_contents($this->getFilePath(), $values); - } - - private function getFilePath(): string { - return drupal_get_path('theme', 'opdavies') . DIRECTORY_SEPARATOR . $this->filename; - } - - private function getValuesFromTable(string $tableName): array { - return $this->database->select($tableName) - ->fields($tableName, ['body_value']) - ->execute() - ->fetchCol(); - } - -}