Skip to content

Commit

Permalink
Merge pull request DoctrineEncryptBundle#6 from DoctrineEncryptBundle…
Browse files Browse the repository at this point in the history
…/rossjcooper-patch

Rossjcooper patch
  • Loading branch information
r3hp1c authored Jul 17, 2023
2 parents 872b324 + a04e74a commit a8f4e20
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 5 additions & 3 deletions src/Command/DoctrineDecryptDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
} else {
$output->writeln('Given encryptor does not exists');

return $output->writeln('Supported encryptors: ' . implode(', ', array_keys($supportedExtensions)));
$output->writeln('Supported encryptors: ' . implode(', ', array_keys($supportedExtensions)));

return defined('AbstractCommand::INVALID') ? AbstractCommand::INVALID : 2;
}
}
}
Expand Down Expand Up @@ -82,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);

if (!$question->ask($input, $output, $confirmationQuestion)) {
return 1;
return defined('AbstractCommand::FAILURE') ? AbstractCommand::FAILURE : 1;
}

// Start decrypting database
Expand Down Expand Up @@ -147,6 +149,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$output->writeln('' . PHP_EOL . 'Decryption finished values found: <info>' . $valueCounter . '</info>, decrypted: <info>' . $this->subscriber->decryptCounter . '</info>.' . PHP_EOL . 'All values are now decrypted.');

return 0;
return defined('AbstractCommand::SUCCESS') ? AbstractCommand::SUCCESS : 0;
}
}
4 changes: 2 additions & 2 deletions src/Command/DoctrineEncryptDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);

if (!$question->ask($input, $output, $confirmationQuestion)) {
return 1;
return defined('AbstractCommand::FAILURE') ? AbstractCommand::FAILURE : 1;
}

// Start decrypting database
Expand Down Expand Up @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Say it is finished
$output->writeln('Encryption finished. Values encrypted: <info>' . $this->subscriber->encryptCounter . ' values</info>.' . PHP_EOL . 'All values are now encrypted.');

return 0;
return defined('AbstractCommand::SUCCESS') ? AbstractCommand::SUCCESS : 0;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Command/DoctrineEncryptStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('');
$output->writeln(sprintf('<info>%d</info> entities found which are containing <info>%d</info> encrypted properties.', count($metaDataArray), $totalCount));

return 0;
return defined('AbstractCommand::SUCCESS') ? AbstractCommand::SUCCESS : 0;
}
}
16 changes: 8 additions & 8 deletions src/Resources/doc/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To make your life a little easier we created some commands that you can use for
You can use the comment `doctrine:encrypt:status` to get the current database and encryption information.

```
$ php app/console doctrine:encrypt:status
$ php bin/console doctrine:encrypt:status
```

This command will return the amount of entities and the amount of properties with the @Encrypted tag for each entity.
Expand All @@ -29,17 +29,17 @@ You can use the comment `doctrine:encrypt:database [encryptor]` to encrypt the c
* Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file

```
$ php app/console doctrine:encrypt:database
$ php bin/console doctrine:encrypt:database
```

or you can provide an encryptor (optional).

```
$ php app/console doctrine:encrypt:database Defuse
$ php bin/console doctrine:encrypt:database Defuse
```

```
$ php app/console doctrine:encrypt:database Halite
$ php bin/console doctrine:encrypt:database Halite
```

This command will return the amount of values encrypted in the database.
Expand All @@ -58,17 +58,17 @@ You can use the comment `doctrine:decrypt:database [encryptor]` to decrypt the c
* Default: Your encryptor set in the configuration file or the default encryption class when not set in the configuration file

```
$ php app/console doctrine:decrypt:database
$ php bin/console doctrine:decrypt:database
```

or you can provide an encryptor (optional).

```
$ php app/console doctrine:decrypt:database Defuse
$ php bin/console doctrine:decrypt:database Defuse
```

```
$ php app/console doctrine:decrypt:database Halite
$ php bin/console doctrine:decrypt:database Halite
```

This command will return the amount of entities and the amount of values decrypted in the database.
Expand All @@ -81,4 +81,4 @@ Decryption finished entities found: 26, decrypted 195 values.

You may want to use your own encryption class learn how here:

#### [Custom encryption class](https://github.com/DoctrineEncryptBundle/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md)
#### [Custom encryption class](https://github.com/DoctrineEncryptBundle/DoctrineEncryptBundle/blob/master/src/Resources/doc/custom_encryptor.md)

0 comments on commit a8f4e20

Please sign in to comment.