@@ -19,8 +19,8 @@ |
||
| 19 | 19 | protected function configure() |
| 20 | 20 | { |
| 21 | 21 | $this->setName('about') |
| 22 | - ->setDescription('Short information about AuditApplication') |
|
| 23 | - ->setHelp('<info>audit about</info>'); |
|
| 22 | + ->setDescription('Short information about AuditApplication') |
|
| 23 | + ->setHelp('<info>audit about</info>'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $this->io->write(<<<EOT |
| 35 | 35 | <info>AuditApplication - Database Auditing</info> |
| 36 | 36 | <comment>Creates audit tables and triggers to track data changes in databases.</comment> |
| 37 | -EOT |
|
| 37 | +eot |
|
| 38 | 38 | ); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -70,8 +70,8 @@ |
||
| 70 | 70 | if ($mandatory) |
| 71 | 71 | { |
| 72 | 72 | throw new RuntimeException("Setting '%s' not found in section '%s' configuration file.", |
| 73 | - $settingName, |
|
| 74 | - $sectionName); |
|
| 73 | + $settingName, |
|
| 74 | + $sectionName); |
|
| 75 | 75 | } |
| 76 | 76 | else |
| 77 | 77 | { |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace SetBased\Audit\MySql\Helper; |
| 4 | 4 | |
| 5 | 5 | //---------------------------------------------------------------------------------------------------------------------- |
| 6 | -use SetBased\Audit\MySql\Table\Columns; |
|
| 7 | 6 | use SetBased\Audit\MySQl\Table\ColumnType; |
| 7 | +use SetBased\Audit\MySql\Table\Columns; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * A helper class for column types. |
@@ -94,9 +94,9 @@ |
||
| 94 | 94 | $theName = $theOption; |
| 95 | 95 | } |
| 96 | 96 | $tableRow = ['column_name' => $theName, |
| 97 | - 'data_column_type' => $this->dataTableOptions[$theOption], |
|
| 98 | - 'audit_column_type' => $this->auditTableOptions[$theOption], |
|
| 99 | - 'config_column_type' => null]; |
|
| 97 | + 'data_column_type' => $this->dataTableOptions[$theOption], |
|
| 98 | + 'audit_column_type' => $this->auditTableOptions[$theOption], |
|
| 99 | + 'config_column_type' => null]; |
|
| 100 | 100 | $this->rows[$theOption] = RowHelper::createTableRow($tableRow); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | { |
| 94 | 94 | $theName = $theOption; |
| 95 | 95 | } |
| 96 | - $tableRow = ['column_name' => $theName, |
|
| 96 | + $tableRow = ['column_name' => $theName, |
|
| 97 | 97 | 'data_column_type' => $this->dataTableOptions[$theOption], |
| 98 | 98 | 'audit_column_type' => $this->auditTableOptions[$theOption], |
| 99 | 99 | 'config_column_type' => null]; |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | $auditCollationName = isset($theRow['audit_collation_name']) ? $theRow['audit_collation_name'] : null; |
| 26 | 26 | |
| 27 | 27 | $tableRow = ['column_name' => null, |
| 28 | - 'data_table_type' => self::styledOptionsRow($dataCharsetName, $dataCollationName), |
|
| 29 | - 'audit_table_type' => self::styledOptionsRow($auditCharsetName, $auditCollationName), |
|
| 30 | - 'config_type' => null]; |
|
| 28 | + 'data_table_type' => self::styledOptionsRow($dataCharsetName, $dataCollationName), |
|
| 29 | + 'audit_table_type' => self::styledOptionsRow($auditCharsetName, $auditCollationName), |
|
| 30 | + 'config_type' => null]; |
|
| 31 | 31 | |
| 32 | 32 | return $tableRow; |
| 33 | 33 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | public static function createTableRow($theRow) |
| 61 | 61 | { |
| 62 | 62 | $tableRow = ['column_name' => isset($theRow['column_name']) ? $theRow['column_name'] : null, |
| 63 | - 'data_table_type' => isset($theRow['data_column_type']) ? $theRow['data_column_type'] : null, |
|
| 64 | - 'audit_table_type' => isset($theRow['audit_column_type']) ? $theRow['audit_column_type'] : null, |
|
| 65 | - 'config_type' => isset($theRow['config_column_type']) ? $theRow['config_column_type'] : null]; |
|
| 63 | + 'data_table_type' => isset($theRow['data_column_type']) ? $theRow['data_column_type'] : null, |
|
| 64 | + 'audit_table_type' => isset($theRow['audit_column_type']) ? $theRow['audit_column_type'] : null, |
|
| 65 | + 'config_type' => isset($theRow['config_column_type']) ? $theRow['config_column_type'] : null]; |
|
| 66 | 66 | |
| 67 | 67 | return $tableRow; |
| 68 | 68 | } |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | protected function configure() |
| 29 | 29 | { |
| 30 | 30 | $this->setName('config') |
| 31 | - ->setDescription('Create or edit config file') |
|
| 32 | - ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json'); |
|
| 31 | + ->setDescription('Create or edit config file') |
|
| 32 | + ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -268,7 +268,7 @@ |
||
| 268 | 268 | /** |
| 269 | 269 | * Selects and returns the metadata of the columns of this table from information_schema. |
| 270 | 270 | * |
| 271 | - * @return array[] |
|
| 271 | + * @return \array[] |
|
| 272 | 272 | */ |
| 273 | 273 | private function getColumnsFromInformationSchema() |
| 274 | 274 | { |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | public function createMissingAuditTable() |
| 110 | 110 | { |
| 111 | 111 | $this->io->logInfo('Creating audit table <dbo>%s.%s<dbo>', |
| 112 | - $this->auditSchemaName, |
|
| 113 | - $this->configTable->getTableName()); |
|
| 112 | + $this->auditSchemaName, |
|
| 113 | + $this->configTable->getTableName()); |
|
| 114 | 114 | |
| 115 | 115 | // In the audit table all columns from the data table must be nullable. |
| 116 | 116 | $dataTableColumnsDatabase = clone($this->dataTableColumnsDatabase); |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $columns = TableColumnsMetadata::combine($this->auditColumns, $dataTableColumnsDatabase); |
| 120 | 120 | AuditDataLayer::createAuditTable($this->configTable->getSchemaName(), |
| 121 | - $this->auditSchemaName, |
|
| 122 | - $this->configTable->getTableName(), |
|
| 123 | - $columns); |
|
| 121 | + $this->auditSchemaName, |
|
| 122 | + $this->configTable->getTableName(), |
|
| 123 | + $columns); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | $this->configTable->getTableName()); |
| 241 | 241 | |
| 242 | 242 | AuditDataLayer::createAuditTrigger($this->configTable->getSchemaName(), |
| 243 | - $this->auditSchemaName, |
|
| 244 | - $this->configTable->getTableName(), |
|
| 245 | - $triggerName, |
|
| 246 | - $action, |
|
| 247 | - $this->auditColumns, |
|
| 248 | - $this->dataTableColumnsDatabase, |
|
| 249 | - $skipVariable, |
|
| 250 | - $additionSql); |
|
| 243 | + $this->auditSchemaName, |
|
| 244 | + $this->configTable->getTableName(), |
|
| 245 | + $triggerName, |
|
| 246 | + $action, |
|
| 247 | + $this->auditColumns, |
|
| 248 | + $this->dataTableColumnsDatabase, |
|
| 249 | + $skipVariable, |
|
| 250 | + $additionSql); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | foreach ($alteredColumns->getColumns() as $column) |
| 412 | 412 | { |
| 413 | 413 | $this->io->logInfo('Type of <dbo>%s.%s</dbo> has been altered to <dbo>%s</dbo>', |
| 414 | - $this->configTable->getTableName(), |
|
| 415 | - $column['column_name'], |
|
| 416 | - $column['column_type']); |
|
| 414 | + $this->configTable->getTableName(), |
|
| 415 | + $column['column_name'], |
|
| 416 | + $column['column_type']); |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @param array[] $columns The metadata of the columns of a table. |
| 55 | 55 | * |
| 56 | - * @return array[] |
|
| 56 | + * @return \array[] |
|
| 57 | 57 | */ |
| 58 | 58 | private static function removeMatchingColumns($columns) |
| 59 | 59 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | /** |
| 143 | 143 | * Add not null to audit columns if it not nullable. |
| 144 | 144 | * |
| 145 | - * @param array $theColumns Audit columns. |
|
| 145 | + * @param \array[] $theColumns Audit columns. |
|
| 146 | 146 | * |
| 147 | 147 | * @return array |
| 148 | 148 | */ |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param Columns $dataColumns The table columns from data schema. |
| 174 | 174 | * @param Columns $auditColumns The table columns from audit schema. |
| 175 | 175 | * |
| 176 | - * @return \array[] |
|
| 176 | + * @return ColumnTypesExtended |
|
| 177 | 177 | */ |
| 178 | 178 | private function createDiffArray($dataColumns, $auditColumns) |
| 179 | 179 | { |
@@ -73,9 +73,9 @@ |
||
| 73 | 73 | protected function configure() |
| 74 | 74 | { |
| 75 | 75 | $this->setName('diff') |
| 76 | - ->setDescription('Compares data tables and audit tables') |
|
| 77 | - ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json') |
|
| 78 | - ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns'); |
|
| 76 | + ->setDescription('Compares data tables and audit tables') |
|
| 77 | + ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json') |
|
| 78 | + ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | * |
| 145 | 145 | * @param string $columnName The column name. |
| 146 | 146 | * |
| 147 | - * @return null|string |
|
| 147 | + * @return integer|null |
|
| 148 | 148 | */ |
| 149 | 149 | public function getPreviousColumn($columnName) |
| 150 | 150 | { |