Skip to content

Commit

Permalink
Fix comment/text typos
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeinbier committed Sep 20, 2016
1 parent 571afbd commit 14850a2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Command/DoctrineEncryptDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
* Hello World command for demo purposes.
*
* Batch encryption for the database
*
* @author Marcel van Nuil <[email protected]>
* @author Michael Feinbier <[email protected]>
*/
class DoctrineEncryptDatabaseCommand extends ContainerAwareCommand
{
Expand All @@ -27,8 +27,8 @@ protected function configure()
{
$this
->setName('doctrine:encrypt:database')
->setDescription('Decrypt whole database on tables which are encrypted')
->addArgument('encryptor', InputArgument::OPTIONAL, 'The encryptor u want to decrypt the database with')
->setDescription('Encrypt whole database on tables which are not encrypted yet')
->addArgument('encryptor', InputArgument::OPTIONAL, 'The encryptor you want to decrypt the database with')
->addArgument('batchSize', InputArgument::OPTIONAL, 'The update/flush batch size', 20);

}
Expand Down Expand Up @@ -57,9 +57,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$subscriber->setEncryptor($input->getArgument('encryptor'));
} else {
$output->writeln("\nGiven encryptor does not exists");
$output->writeln("Supported encryptors: " . implode(", ", array_keys($supportedExtensions)));
$output->writeln("You can also define your own class. (example: Ambta\DoctrineEncryptBundle\Encryptors\Rijndael128Encryptor)");
$output->writeln('\nGiven encryptor does not exists');
$output->writeln('Supported encryptors: ' . implode(', ', array_keys($supportedExtensions)));
$output->writeln('You can also define your own class. (example: Ambta\DoctrineEncryptBundle\Encryptors\Rijndael128Encryptor)');
return;
}
}
Expand All @@ -81,20 +81,20 @@ protected function execute(InputInterface $input, OutputInterface $output)

//Count propperties in metadata
foreach($propertyArray as $property) {
if($annotationReader->getPropertyAnnotation($property, "Ambta\DoctrineEncryptBundle\Configuration\Encrypted")) {
if($annotationReader->getPropertyAnnotation($property, 'Ambta\DoctrineEncryptBundle\Configuration\Encrypted')) {
$propertyCount++;
}
}
}

$confirmationQuestion = new ConfirmationQuestion("<question>\n" . count($metaDataArray) . " entitys found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be encrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinu with this action? (y/yes)</question>", false);
$confirmationQuestion = new ConfirmationQuestion("<question>\n" . count($metaDataArray) . " entities found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be encrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinue with this action? (y/yes)</question>", false);

if (!$question->ask($input, $output, $confirmationQuestion)) {
return;
}

//Start decrypting database
$output->writeln("\nEncrypting all fields this can take up to several minutes depending on the database size.");
$output->writeln("\nEncrypting all fields can take up to several minutes depending on the database size.");

//Loop through entity manager meta data
foreach($metaDataArray as $metaData) {
Expand All @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

//Count propperties in metadata
foreach ($propertyArray as $property) {
if ($annotationReader->getPropertyAnnotation($property, "Ambta\DoctrineEncryptBundle\Configuration\Encrypted")) {
if ($annotationReader->getPropertyAnnotation($property, 'Ambta\DoctrineEncryptBundle\Configuration\Encrypted')) {
$propertyCount++;
}
}
Expand All @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

//If class is not an superclass
$i = 0;
if (!$annotationReader->getClassAnnotation($reflectionClass, "Doctrine\ORM\Mapping\MappedSuperclass")) {
if (!$annotationReader->getClassAnnotation($reflectionClass, 'Doctrine\ORM\Mapping\MappedSuperclass')) {
$iterator = $this->getEntityIterator($entityManager, $metaData->name);
$totalCount = $this->getTableCount($entityManager, $metaData->name);

Expand All @@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

//Say it is finished
$output->writeln("\nEncryption finished values encrypted: " . $subscriber->encryptCounter . " values.\nAll values are now encrypted.");
$output->writeln("\nEncryption finished. Values encrypted: <info>" . $subscriber->encryptCounter . " values</info>.\nAll values are now encrypted.");
}

/**
Expand Down

0 comments on commit 14850a2

Please sign in to comment.