| @@ 27-48 (lines=22) @@ | ||
| 24 | ||
| 25 | } |
|
| 26 | ||
| 27 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 28 | { |
|
| 29 | parent::execute($input, $output); |
|
| 30 | ||
| 31 | // Operations config |
|
| 32 | $cleanupConf = $this->config->getDeleteCleanup(); |
|
| 33 | if (is_null($cleanupConf)) { |
|
| 34 | $this->output->warn('There is nothing to delete according to configuration.'); |
|
| 35 | return; |
|
| 36 | } |
|
| 37 | ||
| 38 | // Setup connection |
|
| 39 | $this->setup(); |
|
| 40 | ||
| 41 | // Perform |
|
| 42 | $this->databaseSize['before'] = $this->db->size($this->config->getDatabaseName()); |
|
| 43 | $this->performDeleteOperations($cleanupConf); |
|
| 44 | $this->databaseSize['after'] = $this->db->size($this->config->getDatabaseName()); |
|
| 45 | ||
| 46 | // Output gain |
|
| 47 | $this->outputGain(); |
|
| 48 | } |
|
| 49 | ||
| 50 | protected function performDeleteOperations($cleanupConf) |
|
| 51 | { |
|
| @@ 24-48 (lines=25) @@ | ||
| 21 | ->setDescription($description); |
|
| 22 | } |
|
| 23 | ||
| 24 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 25 | { |
|
| 26 | parent::execute($input, $output); |
|
| 27 | ||
| 28 | // Operations config |
|
| 29 | $cleanupConf = $this->config->getTruncateCleanup(); |
|
| 30 | if (is_null($cleanupConf)) { |
|
| 31 | $this->output->warn('There is nothing to truncate according to configuration.'); |
|
| 32 | return; |
|
| 33 | } |
|
| 34 | ||
| 35 | // Setup connection |
|
| 36 | $this->setup(); |
|
| 37 | ||
| 38 | // Tables |
|
| 39 | $tables = $this->filterByConf($cleanupConf); |
|
| 40 | ||
| 41 | // Perform |
|
| 42 | $this->databaseSize['before'] = $this->db->size($this->config->getDatabaseName()); |
|
| 43 | $this->performTruncateOperations($tables); |
|
| 44 | $this->databaseSize['after'] = $this->db->size($this->config->getDatabaseName()); |
|
| 45 | ||
| 46 | // Output gain |
|
| 47 | $this->outputGain(); |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param \stdClass $cleanupConf |
|