1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-06 17:41:01 +00:00
This commit is contained in:
Jeremy Benoist 2024-08-14 16:39:36 +02:00
parent bf329d34d8
commit c6a69e595c
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
23 changed files with 57 additions and 57 deletions

View file

@ -65,7 +65,7 @@ class CleanDownloadedImagesCommand extends Command
$existingPaths[] = $file->getFilename();
}
$io->text(sprintf(' -> <info>%d</info> images found', \count($existingPaths)));
$io->text(\sprintf(' -> <info>%d</info> images found', \count($existingPaths)));
$io->text('Retrieve valid folders attached to a user');
@ -84,7 +84,7 @@ class CleanDownloadedImagesCommand extends Command
$validPaths[] = explode('/', $path)[2];
}
$io->text(sprintf(' -> <info>%d</info> folders found', \count($validPaths)));
$io->text(\sprintf(' -> <info>%d</info> folders found', \count($validPaths)));
$deletedCount = 0;
@ -103,11 +103,11 @@ class CleanDownloadedImagesCommand extends Command
$deletedCount += \count($files);
$io->text(sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files)));
$io->text(\sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files)));
}
}
$io->success(sprintf('Finished cleaning. %d deleted images', $deletedCount));
$io->success(\sprintf('Finished cleaning. %d deleted images', $deletedCount));
return 0;
}

View file

@ -56,7 +56,7 @@ class CleanDuplicatesCommand extends Command
$user = $this->getUser($username);
$this->cleanDuplicates($user);
} catch (NoResultException $e) {
$this->io->error(sprintf('User "%s" not found.', $username));
$this->io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@ -65,13 +65,13 @@ class CleanDuplicatesCommand extends Command
} else {
$users = $this->userRepository->findAll();
$this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
$this->io->text(\sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
foreach ($users as $user) {
$this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
$this->io->text(\sprintf('Processing user <info>%s</info>', $user->getUsername()));
$this->cleanDuplicates($user);
}
$this->io->success(sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
$this->io->success(\sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
}
return 0;
@ -99,7 +99,7 @@ class CleanDuplicatesCommand extends Command
$this->duplicates += $duplicatesCount;
$this->io->text(sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
$this->io->text(\sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
}
private function similarUrl($url)

View file

@ -56,7 +56,7 @@ class ExportCommand extends Command
try {
$user = $this->userRepository->findOneByUserName($input->getArgument('username'));
} catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
$io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
@ -66,12 +66,12 @@ class ExportCommand extends Command
->getQuery()
->getResult();
$io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
$io->text(\sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
$filePath = $input->getArgument('filepath');
if (!$filePath) {
$filePath = $this->projectDir . '/' . sprintf('%s-export.json', $user->getUsername());
$filePath = $this->projectDir . '/' . \sprintf('%s-export.json', $user->getUsername());
}
try {
@ -82,7 +82,7 @@ class ExportCommand extends Command
->exportJsonData();
file_put_contents($filePath, $data);
} catch (\InvalidArgumentException $e) {
$io->error(sprintf('Error: "%s"', $e->getMessage()));
$io->error(\sprintf('Error: "%s"', $e->getMessage()));
return 1;
}

View file

@ -50,17 +50,17 @@ class GenerateUrlHashesCommand extends Command
$user = $this->getUser($username);
$this->generateHashedUrls($user);
} catch (NoResultException $e) {
$output->writeln(sprintf('<error>User "%s" not found.</error>', $username));
$output->writeln(\sprintf('<error>User "%s" not found.</error>', $username));
return 1;
}
} else {
$users = $this->userRepository->findAll();
$output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users)));
$output->writeln(\sprintf('Generating hashed urls for "%d" users', \count($users)));
foreach ($users as $user) {
$output->writeln(sprintf('Processing user: %s', $user->getUsername()));
$output->writeln(\sprintf('Processing user: %s', $user->getUsername()));
$this->generateHashedUrls($user);
}
$output->writeln('Finished generated hashed urls');
@ -86,7 +86,7 @@ class GenerateUrlHashesCommand extends Command
$this->entityManager->flush();
$this->output->writeln(sprintf('Generated hashed urls for user: %s', $user->getUserName()));
$this->output->writeln(\sprintf('Generated hashed urls for user: %s', $user->getUserName()));
}
/**

View file

@ -98,7 +98,7 @@ class ImportCommand extends Command
$output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---');
if (!file_exists($input->getArgument('filepath'))) {
throw new Exception(sprintf('File "%s" not found', $input->getArgument('filepath')));
throw new Exception(\sprintf('File "%s" not found', $input->getArgument('filepath')));
}
// Turning off doctrine default logs queries for saving memory
@ -115,7 +115,7 @@ class ImportCommand extends Command
}
if (!\is_object($entityUser)) {
throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
throw new Exception(\sprintf('User "%s" not found', $input->getArgument('username')));
}
// Authenticate user for paywalled websites

View file

@ -41,7 +41,7 @@ class RedisWorkerCommand extends Command
$serviceName = $input->getArgument('serviceName');
if (!$this->container->has('wallabag.queue.redis.' . $serviceName) || !$this->container->has('wallabag.consumer.redis.' . $serviceName)) {
throw new Exception(sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
throw new Exception(\sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
}
$worker = new QueueWorker(

View file

@ -109,7 +109,7 @@ class InstallCommand extends Command
$help = 'Database driver "' . $this->databaseDriver . '" is not installed.';
}
$rows[] = [sprintf($label, $this->databaseDriver), $status, $help];
$rows[] = [\sprintf($label, $this->databaseDriver), $status, $help];
// testing if connection to the database can be established
$label = '<comment>Database connection</comment>';
@ -388,12 +388,12 @@ class InstallCommand extends Command
$schemaManager = $connection->createSchemaManager();
} catch (\Exception $exception) {
// mysql & sqlite
if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
if (str_contains($exception->getMessage(), \sprintf("Unknown database '%s'", $databaseName))) {
return false;
}
// pgsql
if (str_contains($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
if (str_contains($exception->getMessage(), \sprintf('database "%s" does not exist', $databaseName))) {
return false;
}

View file

@ -59,7 +59,7 @@ class ListUserCommand extends Command
$io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
$io->success(
sprintf(
\sprintf(
'%s/%s%s user(s) displayed.',
\count($users),
$nbUsers,

View file

@ -63,7 +63,7 @@ class ReloadEntryCommand extends Command
->findOneByUserName($username)
->getId();
} catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $username));
$io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@ -80,7 +80,7 @@ class ReloadEntryCommand extends Command
}
$io->note(
sprintf(
\sprintf(
"You're going to reload %s entries. Depending on the number of entry to reload, this could be a very long process.",
$nbEntries
)

View file

@ -47,7 +47,7 @@ class ShowUserCommand extends Command
$user = $this->getUser($username);
$this->showUser($user);
} catch (NoResultException $e) {
$this->io->error(sprintf('User "%s" not found.', $username));
$this->io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@ -58,13 +58,13 @@ class ShowUserCommand extends Command
private function showUser(User $user)
{
$this->io->listing([
sprintf('Username: %s', $user->getUsername()),
sprintf('Email: %s', $user->getEmail()),
sprintf('Display name: %s', $user->getName()),
sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
\sprintf('Username: %s', $user->getUsername()),
\sprintf('Email: %s', $user->getEmail()),
\sprintf('Display name: %s', $user->getName()),
\sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
\sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
\sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
\sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
]);
}

View file

@ -49,12 +49,12 @@ class TagAllCommand extends Command
try {
$user = $this->getUser($input->getArgument('username'));
} catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
$io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
$io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
$io->text(\sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
$entries = $this->ruleBasedTagger->tagAllForUser($user);