From 5d80d357b68b21f54bb4c6aa8d4f0785c31f261f Mon Sep 17 00:00:00 2001 From: Felipe Figueroa Date: Thu, 31 Dec 2020 01:24:20 -0300 Subject: ignores develop tools for static analysis and code style --- .github/workflows/coding_standards.yml | 4 +- .gitignore | 5 +- .phive/phars.xml | 9 -- README.md | 2 +- config.inc.example.php | 190 --------------------------------- config.inc.php-dist | 190 +++++++++++++++++++++++++++++++++ mk_linters.mk | 2 +- src/lib.inc.php | 2 +- tools/phpcs | 1 - tools/phpmd | 1 - tools/reviewdog | Bin 16261120 -> 0 bytes 11 files changed, 199 insertions(+), 207 deletions(-) delete mode 100644 .phive/phars.xml delete mode 100644 config.inc.example.php create mode 100644 config.inc.php-dist delete mode 120000 tools/phpcs delete mode 120000 tools/phpmd delete mode 100755 tools/reviewdog diff --git a/.github/workflows/coding_standards.yml b/.github/workflows/coding_standards.yml index c8204158..6a88a3be 100644 --- a/.github/workflows/coding_standards.yml +++ b/.github/workflows/coding_standards.yml @@ -92,8 +92,8 @@ jobs: key: "php-${{ matrix.php_version }}-phpcs-${{ github.sha }}" restore-keys: "php-${{ matrix.php_version }}-phpcs-" -# - name: "Run CodeShiffer" -# run: phpcs --standard=.phpcs.xml --parallel=2 --cache=.build/phpcs/php-cs.cache --report=checkstyle src/* | cs2pr + - name: "Run CodeShiffer" + run: phpcs --standard=.phpcs.xml --parallel=2 --cache=.build/phpcs/php-cs.cache --report=checkstyle src/* | cs2pr - name: "Run friendsofphp/php-cs-fixer" diff --git a/.gitignore b/.gitignore index 9acfa9d8..07331071 100644 --- a/.gitignore +++ b/.gitignore @@ -60,4 +60,7 @@ temp/*.report.json temp/*.report.xml tools/composer* tools/phpcbf -tools/phpmd_checkstyle \ No newline at end of file +tools/phpmd_checkstyle +.phive +tools/reviewdog + diff --git a/.phive/phars.xml b/.phive/phars.xml deleted file mode 100644 index 556fcde2..00000000 --- a/.phive/phars.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/README.md b/README.md index df11d495..5496517c 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ composer install --no-dev ## Configuration -You can set the config options either in a `config.inc.php` (refer to [config.inc.php-dist](config.inc.php-dist) for an example) +You can set the config options either in a `config.inc.php` (refer to [config.inc.example.php](config.inc.example.php) for an example) AND/OR a [config.yml](config.yml). The use of the latter is complely optional. Keep in mind the config entries are merged giving precedence to the ones in the YAML file. diff --git a/config.inc.example.php b/config.inc.example.php deleted file mode 100644 index a87b63c4..00000000 --- a/config.inc.example.php +++ /dev/null @@ -1,190 +0,0 @@ - '', - - /** - * enable this to calculate schema and table sizes. This will have a performance impact - * e.g. $conf['display_sizes'] = true. - * - * you can also enable it specifically for tables and or schemas: - * $conf['display_sizes'] = ['schemas'=>false,'tables'=>true]; - */ - 'display_sizes' => false, - - /** - * Set to true if you want to enable debugging output. - */ - 'debugmode' => false, - - /** - * Don't touch this value. It's used to inform the config structure has a breaking change. - */ - 'version' => 61, -]; - -// Two debug library examples. Pick one of course. -$conf['register_debuggers'] = static function (): void { - //require_once __DIR__ . '/.configs/debug.kint.php'; - //require_once __DIR__ . '/.configs/debug.var_dumper.php'; -}; - -// optionally, set a path for your error log, relative to this project root -// $conf['error_log']='temp/phppga.php_error.log'; - -// An example server. Create as many of these as you wish, -// indexed from zero upwards. -$server_index = 0; - -/** - * $conf['servers'] is an array that holds (at least) one server block. - * - * @see https://github.com/HuasoFoundries/phpPgAdmin6/wiki/Config:-servers - */ -$conf['servers'][$server_index] = [ - // Display name for the server on the login screen - 'desc' => 'PostgreSQL', - - // Hostname or IP address for server. Use '' for UNIX domain socket. - // use 'localhost' for TCP/IP connection on this computer - 'host' => '', - - // Database port on server (5432 is the PostgreSQL default) - 'port' => 5432, - - // Database SSL mode - // Possible options: disable, allow, prefer, require - // To require SSL on older servers use option: legacy - // To ignore the SSL mode, use option: unspecified - 'sslmode' => 'allow', - - // Change the default database only if you cannot connect to template1. - // For a PostgreSQL 8.1+ server, you can set this to 'postgres'. - 'defaultdb' => 'template1', - - // Specify the path to the database dump utilities for this server. - // You can set these to '' if no dumper is available. - 'pg_dump_path' => '/usr/bin/pg_dump', - 'pg_dumpall_path' => '/usr/bin/pg_dumpall', -]; - -// Server group 0 will show up with an alias -$conf['srv_groups'][0]['desc'] = 'dev1 and prod2'; -// Add here servers indexes belonging to the group '0' seperated by comma -$conf['srv_groups'][0]['servers'] = '1,3'; - -// Default language. E.g.: 'english', 'polish', etc. See lang/ directory -// for all possibilities. If you specify 'auto' (the default) it will use -// your browser preference. -$conf['default_lang'] = 'auto'; - -// AutoComplete uses AJAX interaction to list foreign key values -// on insert fields. It currently only works on single column -// foreign keys. You can choose one of the following values: -// 'default on' enables AutoComplete and turns it on by default. -// 'default off' enables AutoComplete but turns it off by default. -// 'disable' disables AutoComplete. -$conf['autocomplete'] = 'default on'; - -// If extra login security is true, then logins via phpPgAdmin with no -// password or certain usernames (pgsql, postgres, root, administrator) -// will be denied. Only set this false once you have read the FAQ and -// understand how to change PostgreSQL's pg_hba.conf to enable -// passworded local connections. -$conf['extra_login_security'] = true; - -// Only show owned databases? -// Note: This will simply hide other databases in the list - this does -// not in any way prevent your users from seeing other database by -// other means. (e.g. Run 'SELECT * FROM pg_database' in the SQL area.) -$conf['owned_only'] = false; - -// Display comments on objects? Comments are a good way of documenting -// a database, but they do take up space in the interface. -$conf['show_comments'] = true; - -// Display "advanced" objects? Setting this to true will show -// aggregates, types, operators, operator classes, conversions, -// languages and casts in phpPgAdmin. These objects are rarely -// administered and can clutter the interface. -$conf['show_advanced'] = false; - -// Display "system" objects? -$conf['show_system'] = false; - -// Minimum length users can set their password to. -$conf['min_password_length'] = 1; - -// Width of the left frame in pixels (object browser) -$conf['left_width'] = 200; - -// Which look & feel theme to use -$conf['theme'] = 'default'; - -// Show OIDs when browsing tables? -$conf['show_oids'] = false; - -// Max rows to show on a page when browsing record sets -$conf['max_rows'] = 30; - -// Max chars of each field to display by default in browse mode -$conf['max_chars'] = 50; - -// Send XHTML strict headers? -$conf['use_xhtml_strict'] = false; - -// Base URL for PostgreSQL documentation. -// '%s', if present, will be replaced with the PostgreSQL version -// (e.g. 8.4 ) -$conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/'; - -// Configuration for ajax scripts -// Time in seconds. If set to 0, refreshing data using ajax will be disabled (locks and activity pages) -$conf['ajax_refresh'] = 3; - -// If there's a config.yml in the root folder, parse it and merge its contents with $conf array -// see config.example.yml -$yamlConfigPath = \implode(\DIRECTORY_SEPARATOR, [__DIR__, 'config.yml']); - -if (\is_readable($yamlConfigPath) && \class_exists('Symfony\Component\Yaml\Yaml')) { - try { - $yamlConfig = Yaml::parseFile($yamlConfigPath); - // Servers and srv_groups must be merged beforehand - $servers = $conf['servers'] ?? []; - - foreach ($yamlConfig['servers'] ?? [] as $index => $srv) { - $servers[] = $srv; - } - $srv_groups = $conf['srv_groups'] ?? []; - - foreach ($yamlConfig['srv_groups'] ?? [] as $index => $srv_group) { - $srv_groups[] = $srv; - } - - $yamlConfig['srv_groups'] = \array_merge([ - $conf['srv_groups'] ?? [], - $yamlConfig['srv_groups'] ?? [], - ]); - $conf = \array_merge($conf, $yamlConfig); - - $conf['servers'] = $servers ?? []; - $conf['srv_groups'] = $srv_groups ?? []; - } catch (\Exception $e) { - die($e->getMessage()); - \error_log($e->getTraceAsString()); - } -} diff --git a/config.inc.php-dist b/config.inc.php-dist new file mode 100644 index 00000000..a87b63c4 --- /dev/null +++ b/config.inc.php-dist @@ -0,0 +1,190 @@ + '', + + /** + * enable this to calculate schema and table sizes. This will have a performance impact + * e.g. $conf['display_sizes'] = true. + * + * you can also enable it specifically for tables and or schemas: + * $conf['display_sizes'] = ['schemas'=>false,'tables'=>true]; + */ + 'display_sizes' => false, + + /** + * Set to true if you want to enable debugging output. + */ + 'debugmode' => false, + + /** + * Don't touch this value. It's used to inform the config structure has a breaking change. + */ + 'version' => 61, +]; + +// Two debug library examples. Pick one of course. +$conf['register_debuggers'] = static function (): void { + //require_once __DIR__ . '/.configs/debug.kint.php'; + //require_once __DIR__ . '/.configs/debug.var_dumper.php'; +}; + +// optionally, set a path for your error log, relative to this project root +// $conf['error_log']='temp/phppga.php_error.log'; + +// An example server. Create as many of these as you wish, +// indexed from zero upwards. +$server_index = 0; + +/** + * $conf['servers'] is an array that holds (at least) one server block. + * + * @see https://github.com/HuasoFoundries/phpPgAdmin6/wiki/Config:-servers + */ +$conf['servers'][$server_index] = [ + // Display name for the server on the login screen + 'desc' => 'PostgreSQL', + + // Hostname or IP address for server. Use '' for UNIX domain socket. + // use 'localhost' for TCP/IP connection on this computer + 'host' => '', + + // Database port on server (5432 is the PostgreSQL default) + 'port' => 5432, + + // Database SSL mode + // Possible options: disable, allow, prefer, require + // To require SSL on older servers use option: legacy + // To ignore the SSL mode, use option: unspecified + 'sslmode' => 'allow', + + // Change the default database only if you cannot connect to template1. + // For a PostgreSQL 8.1+ server, you can set this to 'postgres'. + 'defaultdb' => 'template1', + + // Specify the path to the database dump utilities for this server. + // You can set these to '' if no dumper is available. + 'pg_dump_path' => '/usr/bin/pg_dump', + 'pg_dumpall_path' => '/usr/bin/pg_dumpall', +]; + +// Server group 0 will show up with an alias +$conf['srv_groups'][0]['desc'] = 'dev1 and prod2'; +// Add here servers indexes belonging to the group '0' seperated by comma +$conf['srv_groups'][0]['servers'] = '1,3'; + +// Default language. E.g.: 'english', 'polish', etc. See lang/ directory +// for all possibilities. If you specify 'auto' (the default) it will use +// your browser preference. +$conf['default_lang'] = 'auto'; + +// AutoComplete uses AJAX interaction to list foreign key values +// on insert fields. It currently only works on single column +// foreign keys. You can choose one of the following values: +// 'default on' enables AutoComplete and turns it on by default. +// 'default off' enables AutoComplete but turns it off by default. +// 'disable' disables AutoComplete. +$conf['autocomplete'] = 'default on'; + +// If extra login security is true, then logins via phpPgAdmin with no +// password or certain usernames (pgsql, postgres, root, administrator) +// will be denied. Only set this false once you have read the FAQ and +// understand how to change PostgreSQL's pg_hba.conf to enable +// passworded local connections. +$conf['extra_login_security'] = true; + +// Only show owned databases? +// Note: This will simply hide other databases in the list - this does +// not in any way prevent your users from seeing other database by +// other means. (e.g. Run 'SELECT * FROM pg_database' in the SQL area.) +$conf['owned_only'] = false; + +// Display comments on objects? Comments are a good way of documenting +// a database, but they do take up space in the interface. +$conf['show_comments'] = true; + +// Display "advanced" objects? Setting this to true will show +// aggregates, types, operators, operator classes, conversions, +// languages and casts in phpPgAdmin. These objects are rarely +// administered and can clutter the interface. +$conf['show_advanced'] = false; + +// Display "system" objects? +$conf['show_system'] = false; + +// Minimum length users can set their password to. +$conf['min_password_length'] = 1; + +// Width of the left frame in pixels (object browser) +$conf['left_width'] = 200; + +// Which look & feel theme to use +$conf['theme'] = 'default'; + +// Show OIDs when browsing tables? +$conf['show_oids'] = false; + +// Max rows to show on a page when browsing record sets +$conf['max_rows'] = 30; + +// Max chars of each field to display by default in browse mode +$conf['max_chars'] = 50; + +// Send XHTML strict headers? +$conf['use_xhtml_strict'] = false; + +// Base URL for PostgreSQL documentation. +// '%s', if present, will be replaced with the PostgreSQL version +// (e.g. 8.4 ) +$conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/'; + +// Configuration for ajax scripts +// Time in seconds. If set to 0, refreshing data using ajax will be disabled (locks and activity pages) +$conf['ajax_refresh'] = 3; + +// If there's a config.yml in the root folder, parse it and merge its contents with $conf array +// see config.example.yml +$yamlConfigPath = \implode(\DIRECTORY_SEPARATOR, [__DIR__, 'config.yml']); + +if (\is_readable($yamlConfigPath) && \class_exists('Symfony\Component\Yaml\Yaml')) { + try { + $yamlConfig = Yaml::parseFile($yamlConfigPath); + // Servers and srv_groups must be merged beforehand + $servers = $conf['servers'] ?? []; + + foreach ($yamlConfig['servers'] ?? [] as $index => $srv) { + $servers[] = $srv; + } + $srv_groups = $conf['srv_groups'] ?? []; + + foreach ($yamlConfig['srv_groups'] ?? [] as $index => $srv_group) { + $srv_groups[] = $srv; + } + + $yamlConfig['srv_groups'] = \array_merge([ + $conf['srv_groups'] ?? [], + $yamlConfig['srv_groups'] ?? [], + ]); + $conf = \array_merge($conf, $yamlConfig); + + $conf['servers'] = $servers ?? []; + $conf['srv_groups'] = $srv_groups ?? []; + } catch (\Exception $e) { + die($e->getMessage()); + \error_log($e->getTraceAsString()); + } +} diff --git a/mk_linters.mk b/mk_linters.mk index 9b4c07ff..faa2b816 100644 --- a/mk_linters.mk +++ b/mk_linters.mk @@ -104,7 +104,7 @@ ifeq (,$(reportformat)) $(eval reportformat='diff') endif @${MAKE} check_executable_or_exit_with_phive executable=$(executable) package_name=$(package_name) --no-print-directory - @mkdir -p .build/phpcs && touch .build/phpcs/php-cs.cache ;\ + @mkdir -p .build/phpcs && touch .build/phpcs/php-cs.cache $(executable) --standard=.phpcs.xml --parallel=2 --cache=.build/phpcs/php-cs.cache --report=$(reportformat) src/* diff --git a/src/lib.inc.php b/src/lib.inc.php index eebef60d..c8e02d77 100644 --- a/src/lib.inc.php +++ b/src/lib.inc.php @@ -19,7 +19,7 @@ function getAppInstance(): App $subfolder = ''; // Check to see if the configuration file exists, if not, explain if (!\file_exists(\dirname(__DIR__) . '/config.inc.php')) { - die('Configuration error: Copy config.inc.example.php to config.inc.php and edit appropriately.'); + die('Configuration error: Copy config.inc.php-dist to config.inc.php and edit appropriately.'); } $conf = []; diff --git a/tools/phpcs b/tools/phpcs deleted file mode 120000 index 18b16ce6..00000000 --- a/tools/phpcs +++ /dev/null @@ -1 +0,0 @@ -/home/ffflabs/.phive/phars/phpcs-3.5.3.phar \ No newline at end of file diff --git a/tools/phpmd b/tools/phpmd deleted file mode 120000 index 7384b0ce..00000000 --- a/tools/phpmd +++ /dev/null @@ -1 +0,0 @@ -/home/ffflabs/.phive/phars/phpmd-2.7.0.phar \ No newline at end of file diff --git a/tools/reviewdog b/tools/reviewdog deleted file mode 100755 index cf8bccd2..00000000 Binary files a/tools/reviewdog and /dev/null differ -- cgit v1.2.3