@@ -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 | { |
@@ -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 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -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 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | 24 | $this->setName('audit') |
| 25 | - ->setDescription('Create (missing) audit table and (re)creates audit triggers') |
|
| 26 | - ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file'); |
|
| 25 | + ->setDescription('Create (missing) audit table and (re)creates audit triggers') |
|
| 26 | + ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | $auditColumns, |
| 118 | 118 | $skipVariable, |
| 119 | 119 | $additionSql); |
| 120 | - $sql = $helper->buildStatement(); |
|
| 120 | + $sql = $helper->buildStatement(); |
|
| 121 | 121 | |
| 122 | 122 | self::executeNone($sql); |
| 123 | 123 | } |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | $additionSql) |
| 114 | 114 | { |
| 115 | 115 | $helper = new CreateAuditTrigger($dataSchemaName, |
| 116 | - $auditSchemaName, |
|
| 117 | - $tableName, |
|
| 118 | - $triggerAction, |
|
| 119 | - $triggerName, |
|
| 120 | - $auditColumns, |
|
| 121 | - $tableColumns, |
|
| 122 | - $skipVariable, |
|
| 123 | - $additionSql); |
|
| 116 | + $auditSchemaName, |
|
| 117 | + $tableName, |
|
| 118 | + $triggerAction, |
|
| 119 | + $triggerName, |
|
| 120 | + $auditColumns, |
|
| 121 | + $tableColumns, |
|
| 122 | + $skipVariable, |
|
| 123 | + $additionSql); |
|
| 124 | 124 | $sql = $helper->buildStatement(); |
| 125 | 125 | |
| 126 | 126 | self::executeNone($sql); |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | where TABLE_SCHEMA = %s |
| 306 | 306 | and TABLE_NAME = %s |
| 307 | 307 | order by ORDINAL_POSITION', |
| 308 | - self::$dl->quoteString($schemaName), |
|
| 309 | - self::$dl->quoteString($tableName)); |
|
| 308 | + self::$dl->quoteString($schemaName), |
|
| 309 | + self::$dl->quoteString($tableName)); |
|
| 310 | 310 | |
| 311 | 311 | return self::executeRows($sql); |
| 312 | 312 | } |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | inner join information_schema.COLLATION_CHARACTER_SET_APPLICABILITY t2 on t2.COLLATION_NAME = t1.TABLE_COLLATION |
| 331 | 331 | WHERE t1.TABLE_SCHEMA = %s |
| 332 | 332 | AND t1.TABLE_NAME = %s', |
| 333 | - self::$dl->quoteString($schemaName), |
|
| 334 | - self::$dl->quoteString($tableName)); |
|
| 333 | + self::$dl->quoteString($schemaName), |
|
| 334 | + self::$dl->quoteString($tableName)); |
|
| 335 | 335 | |
| 336 | 336 | return self::executeRow1($sql); |
| 337 | 337 | } |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | where TRIGGER_SCHEMA = %s |
| 354 | 354 | and EVENT_OBJECT_TABLE = %s |
| 355 | 355 | order by Trigger_Name', |
| 356 | - self::$dl->quoteString($schemaName), |
|
| 357 | - self::$dl->quoteString($tableName)); |
|
| 356 | + self::$dl->quoteString($schemaName), |
|
| 357 | + self::$dl->quoteString($tableName)); |
|
| 358 | 358 | |
| 359 | 359 | return self::executeRows($sql); |
| 360 | 360 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | where TRIGGER_SCHEMA = %s |
| 377 | 377 | order by EVENT_OBJECT_TABLE |
| 378 | 378 | , TRIGGER_NAME', |
| 379 | - self::$dl->quoteString($schemaName)); |
|
| 379 | + self::$dl->quoteString($schemaName)); |
|
| 380 | 380 | |
| 381 | 381 | return self::executeRows($sql); |
| 382 | 382 | } |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $this->io->writeln(sprintf('<info>Found new table %s</info>', $table['table_name'])); |
| 148 | 148 | $this->config['tables'][$table['table_name']] = ['audit' => false, |
| 149 | - 'alias' => null, |
|
| 150 | - 'skip' => null]; |
|
| 149 | + 'alias' => null, |
|
| 150 | + 'skip' => null]; |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -199,15 +199,15 @@ discard block |
||
| 199 | 199 | $tableColumns = $this->config['table_columns'][$table['table_name']]; |
| 200 | 200 | } |
| 201 | 201 | $configTable = new TableMetadata($table['table_name'], |
| 202 | - $this->config['database']['data_schema'], |
|
| 203 | - $tableColumns); |
|
| 202 | + $this->config['database']['data_schema'], |
|
| 203 | + $tableColumns); |
|
| 204 | 204 | |
| 205 | 205 | $currentTable = new AuditTable($this->io, |
| 206 | - $configTable, |
|
| 207 | - $this->config['database']['audit_schema'], |
|
| 208 | - $this->auditColumnsMetadata, |
|
| 209 | - $this->config['tables'][$table['table_name']]['alias'], |
|
| 210 | - $this->config['tables'][$table['table_name']]['skip']); |
|
| 206 | + $configTable, |
|
| 207 | + $this->config['database']['audit_schema'], |
|
| 208 | + $this->auditColumnsMetadata, |
|
| 209 | + $this->config['tables'][$table['table_name']]['alias'], |
|
| 210 | + $this->config['tables'][$table['table_name']]['skip']); |
|
| 211 | 211 | $res = StaticDataLayer::searchInRowSet('table_name', |
| 212 | 212 | $currentTable->getTableName(), |
| 213 | 213 | $this->auditSchemaTables); |