Skip to content

Commit

Permalink
refactor: rename commands and utility class, remove unused locallang …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
dvdmlln committed Jul 18, 2024
1 parent c68d0a0 commit 6556447
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 27 deletions.
4 changes: 2 additions & 2 deletions Classes/Command/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Remind\Backup\Command;

use Remind\Backup\Service\DatabaseService;
use Remind\Backup\Utility\FileNameUtility;
use Remind\Backup\Utility\FileNamingUtility;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$dir = $input->getOption(self::INPUT_DIR);

$path = FileNameUtility::buildPath(
$path = FileNamingUtility::buildPath(
$dir,
$input->getOption(self::INPUT_FILE),
!$input->getOption(self::INPUT_OMIT_TIMESTAMP),
Expand Down
8 changes: 4 additions & 4 deletions Classes/Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Remind\Backup\Command;

use Remind\Backup\Service\DatabaseService;
use Remind\Backup\Utility\FileNameUtility;
use Remind\Backup\Utility\FileNamingUtility;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$dir = $input->getOption(self::INPUT_DIR);
$file = $input->getOption(self::INPUT_FILE);

$path = FileNameUtility::buildPath($dir, $file, false, true);
$path = FileNamingUtility::buildPath($dir, $file, false, true);

if (!file_exists($path)) {
if (!is_dir($dir)) {
Expand All @@ -68,10 +68,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$files = array_values(array_diff(scandir($dir, SCANDIR_SORT_ASCENDING), ['.', '..']));
$matches = array_filter($files, function (string $fileToCheck) use ($file) {
return preg_match(FileNameUtility::getRegexPattern($file), $fileToCheck);
return preg_match(FileNamingUtility::getRegexPattern($file), $fileToCheck);
});
if (!empty($matches)) {
$path = FileNameUtility::buildPath($dir, array_pop($matches));
$path = FileNamingUtility::buildPath($dir, array_pop($matches));
$output->writeln(sprintf('Use \'%s\' for import.', $path));
} else {
$output->writeln(sprintf('File \'%s\' does not exist.', $path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use TYPO3\CMS\Core\Utility\PathUtility;

class FileNameUtility
class FileNamingUtility
{
public static function getRegexPattern(string $file): string
{
Expand Down
6 changes: 3 additions & 3 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ services:
Remind\Backup\Command\ExportCommand:
tags:
- name: console.command
command: 'remind:database:export'
command: 'remind:backup:export'
description: 'Export database'
Remind\Backup\Command\ImportCommand:
tags:
- name: console.command
command: 'remind:database:import'
command: 'remind:backup:import'
description: 'Import database'
Remind\Backup\Command\DeleteBackupCommand:
tags:
- name: console.command
command: 'remind:database:delete'
command: 'remind:backup:delete'
description: 'Delete database backup'
17 changes: 0 additions & 17 deletions Resources/Private/Language/locallang.xlf

This file was deleted.

0 comments on commit 6556447

Please sign in to comment.