From ff83869b2096c499f29142e3f8e10c9b7d8bf649 Mon Sep 17 00:00:00 2001 From: Mark Sharp Date: Thu, 10 Oct 2024 16:35:44 +0100 Subject: [PATCH] Some adjustments --- .gitignore | 4 +- README.md | 25 +- assets/web/apache2/apache2_conf.conf | 7 + .../web/{ => apache2}/apache2_faildumps.conf | 0 assets/web/{ => apache2}/apache2_mailhog.conf | 0 assets/web/php-ini/apache2_php.ini | 2 + assets/web/vhost.conf | 48 - composer.json | 14 + composer.lock | 911 ++++++++++++++++++ ...template.php => config.docker-template.php | 0 docker-compose.yml | 143 +-- phpcs.sh | 11 + phpdd.sh | 10 + setup.sh | 1 + 14 files changed, 1017 insertions(+), 159 deletions(-) create mode 100644 assets/web/apache2/apache2_conf.conf rename assets/web/{ => apache2}/apache2_faildumps.conf (100%) rename assets/web/{ => apache2}/apache2_mailhog.conf (100%) delete mode 100644 assets/web/vhost.conf create mode 100644 composer.json create mode 100644 composer.lock rename web/config.docker-template.php => config.docker-template.php (100%) create mode 100755 phpcs.sh create mode 100755 phpdd.sh diff --git a/.gitignore b/.gitignore index 5494581..0a3ad58 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ web/behatdata web/behatfaildumps web/phpunitdata .vscode -bin/moodleextra/* \ No newline at end of file +bin/moodleextra/* +/vendor/ +diffs diff --git a/README.md b/README.md index bb74baf..5abccb9 100644 --- a/README.md +++ b/README.md @@ -61,4 +61,27 @@ The basic workflow is to: - get the version of Moodle you want to test/develop against - add any plugins you want test/develop - start up docker -- install Moodle \ No newline at end of file +- install Moodle + +## Phan + +Static analysis tools + +* https://www.php.net/manual/en/appendices.php PHP Deprecations +* https://github.com/phan/phan/wiki/Getting-Started#creating-a-config-file +* https://odan.github.io/2020/12/22/php8-compatibility-check.html +* https://github.com/phan/phan/wiki/Tutorial-for-Analyzing-a-Large-Sloppy-Code-Base + +## PHPDD + +I've included PHP Deprecation Detector in the composer file. Install this to use. + +``` +// Checks that the whole html folder is compatible after PHP 7.4 to PHP 8.0 and outputs to php80.txt file. +// This excludes some development folders and 3rd party library folders that we have no control over, but if you +// want to do a full-full scan remove the exclude list. +./vendor/bin/phpdd scan -t 8.0 -a 7.4 -e codechecker,moodlecheck,node_modules,vendor web/html/ > phpdd.txt + +// You can change the path to check individual plugins e.g. +./vendor/bin/phpdd scan -t 8.0 -a 7.4 web/html/blocks/checklist +``` diff --git a/assets/web/apache2/apache2_conf.conf b/assets/web/apache2/apache2_conf.conf new file mode 100644 index 0000000..68ad2f3 --- /dev/null +++ b/assets/web/apache2/apache2_conf.conf @@ -0,0 +1,7 @@ + + StartServers 15 + MinSpareServers 15 + MaxSpareServers 20 + MaxRequestWorkers 250 + MaxConnectionsPerChild 0 + \ No newline at end of file diff --git a/assets/web/apache2_faildumps.conf b/assets/web/apache2/apache2_faildumps.conf similarity index 100% rename from assets/web/apache2_faildumps.conf rename to assets/web/apache2/apache2_faildumps.conf diff --git a/assets/web/apache2_mailhog.conf b/assets/web/apache2/apache2_mailhog.conf similarity index 100% rename from assets/web/apache2_mailhog.conf rename to assets/web/apache2/apache2_mailhog.conf diff --git a/assets/web/php-ini/apache2_php.ini b/assets/web/php-ini/apache2_php.ini index ec00ed7..1e953be 100644 --- a/assets/web/php-ini/apache2_php.ini +++ b/assets/web/php-ini/apache2_php.ini @@ -3,3 +3,5 @@ opcache.enable_cli = 1 opcache.max_accelerated_files = 15000 zlib.output_compression = 1 x-debug = 1 +upload_max_filesize=100MB +post_max_size=100MB diff --git a/assets/web/vhost.conf b/assets/web/vhost.conf deleted file mode 100644 index 8691d01..0000000 --- a/assets/web/vhost.conf +++ /dev/null @@ -1,48 +0,0 @@ - - #DocumentRoot "{{ getenv "APACHE_DOCUMENT_ROOT" "/var/www/html" }}" - DocumentRoot /var/www/html - # ServerName {{ getenv "APACHE_DOCUMENT_ROOT" }} - #DocumentRoot {{ getenv APACHE_DOCUMENT_ROOT }} - #ServerName {{ getenv "MOODLE_DOCKER_WEB_HOST" "default" }} - ServerName knowledgeexchange.docker.localhost - - # Include conf/preset.conf - - # {{ if not (getenv "APACHE_LIMITED_ACCESS") }} - # - # Require all granted - # - # {{ end }} - - - Order allow,deny - Deny from all - - - - Order allow,deny - Deny from all - - - - Order allow,deny - Deny from all - - - - Order allow,deny - Deny from all - - - - Order allow,deny - Deny from all - - - # {{ if getenv "APACHE_HTTP2" }} - # Protocols h2c http/1.1 - # {{ end }} - - SetEnvIf Request_URI "^/\.healthz$" dontlog - RedirectMatch 204 .healthz - diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..24e1296 --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "sharpm/sol40dev", + "require-dev": { + "wapmorgan/php-deprecation-detector": "^2.0", + "phpcompatibility/php-compatibility": "*" + }, + "authors": [ + { + "name": "Mark Sharp", + "email": "mark.sharp@solent.ac.uk" + } + ], + "require": {} +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..a0fcf3a --- /dev/null +++ b/composer.lock @@ -0,0 +1,911 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "9ad3ccd1410b7c87376026f637bcd40f", + "packages": [], + "packages-dev": [ + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2023-02-22T23:07:41+00:00" + }, + { + "name": "symfony/console", + "version": "v6.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", + "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.3.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-08-16T10:10:12+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "875e90aeea2777b6f135677f618529449334a612" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "42292d99c55abe617799667f454222c54c60e229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-28T09:04:16+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/string", + "version": "v6.3.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", + "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.3.5" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-09-18T10:38:32+00:00" + }, + { + "name": "wapmorgan/php-deprecation-detector", + "version": "2.0.33", + "source": { + "type": "git", + "url": "https://github.com/wapmorgan/PhpDeprecationDetector.git", + "reference": "860e40c545acbd5c2aefdef416d09fb4639198bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wapmorgan/PhpDeprecationDetector/zipball/860e40c545acbd5c2aefdef416d09fb4639198bd", + "reference": "860e40c545acbd5c2aefdef416d09fb4639198bd", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=5.4", + "symfony/console": "^3.4|^4.0|^5.0|^6.0" + }, + "replace": { + "wapmorgan/php-code-fixer": "self.version" + }, + "suggest": { + "ext-json": "Adds ability to store report in JSON format" + }, + "bin": [ + "bin/phpdd" + ], + "type": "package", + "extra": { + "phar-builder": { + "compression": "BZip2", + "name": "phpdd-dev.phar", + "output-dir": "./", + "entry-point": "bin/phpdd", + "include": [ + "bin", + "data" + ], + "events": { + "command.package.start": "git describe --tags > bin/version.txt", + "command.package.end": "cp phpdd-dev.phar phpdd-`cat bin/version.txt`.phar && chmod +x phpdd-`cat bin/version.txt`.phar && rm bin/version.txt" + } + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "wapmorgan\\PhpCodeFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.", + "support": { + "issues": "https://github.com/wapmorgan/PhpDeprecationDetector/issues", + "source": "https://github.com/wapmorgan/PhpDeprecationDetector/tree/2.0.33" + }, + "time": "2023-04-23T09:23:34+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/web/config.docker-template.php b/config.docker-template.php similarity index 100% rename from web/config.docker-template.php rename to config.docker-template.php diff --git a/docker-compose.yml b/docker-compose.yml index 35d06b5..d3854ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,9 +8,11 @@ services: - ${MOODLE_DOCKER_DB} volumes: - "./web:/var/www" - - "${ASSETDIR}/web/apache2_faildumps.conf:/etc/apache2/conf-enabled/apache2_faildumps.conf" - - "${ASSETDIR}/web/apache2_mailhog.conf:/etc/apache2/conf-enabled/apache2_mailhog.conf" - - "${ASSETDIR}/web/php-ini:/usr/local/etc/php/custom.d" + - "${ASSETDIR}/web/apache2/apache2_faildumps.conf:/etc/apache2/conf-enabled/apache2_faildumps.conf" + - "${ASSETDIR}/web/apache2/apache2_mailhog.conf:/etc/apache2/conf-enabled/apache2_mailhog.conf" + - "${ASSETDIR}/web/apache2/apache2_conf.conf:/etc/apache2/conf-enabled/apache2_conf.conf" + - "${ASSETDIR}/web/php-ini/apache2_php.ini:/usr/local/etc/apache2/custom.d/apache2_php.ini" + # - "${ASSETDIR}/web/apache2:/usr/local/etc/apache2/custom.d" # - "${ASSETDIR}/web/vhost.conf:/etc/apache2/sites-available/000-default.conf" environment: MOODLE_DOCKER_DBTYPE: ${MOODLE_DOCKER_DB} @@ -19,15 +21,37 @@ services: MOODLE_DOCKER_DBUSER: ${DB_USER} MOODLE_DOCKER_DBPASS: ${DB_PASSWORD} MOODLE_DOCKER_BROWSER: firefox + #MOODLE_DOCKER_BROWSER: chrome MOODLE_DOCKER_DBCOLLATION: utf8mb4_unicode_ci MOODLE_DOCKER_WEB_HOST: ${PROJECT_BASE_URL} MOODLE_DOCKER_WEB_PORT: 8000 APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT} PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 PHP_INI_SCAN_DIR: "/usr/local/etc/php/custom.d:/usr/local/etc/php/conf.d" + PHP_XDEBUG: 1 + PHP_XDEBUG_DEFAULT_ENABLE: 1 + PHP_XDEBUG_MODE: coverage + PHP_IDE_CONFIG: serverName=my-ide + PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 + PHP_XDEBUG_CLIENT_HOST: host.docker.internal + PHP_EXTENSION_xdebug: 1 labels: - "traefik.http.routers.${PROJECT_NAME}_webserver.rule=Host(`${PROJECT_BASE_URL}`)" + # The admin instance is responsible for triggering the cron task periodically. + # In this compose setup we use a periodic curl command to the web container + # to keep this simple. In a real deployment environment there may be better + # tools for triggering scheduled tasks. + # moodle-cron: + # image: jsonfry/curl-cron + # container_name: ${PROJECT_NAME}_cron + # environment: + # - MAHARA_URL_SECRET + # - CRON_SCHEDULE=* * * * * + # - OPTIONS=http://${PROJECT_BASE_URL}/admin/cron.php?password=secretcron + # labels: + # - "traefik.http.routers.${PROJECT_NAME}_cron.rule=Host(`cron.${PROJECT_BASE_URL}`)" + mariadb: image: mariadb:$MARIADB_TAG container_name: "${PROJECT_NAME}_mariadb" @@ -58,105 +82,28 @@ services: - "traefik.http.services.${PROJECT_NAME}_mariadb.loadbalancer.server.port=3306" - "traefik.http.routers.${PROJECT_NAME}_mariadb.rule=Host(`mariadb.${PROJECT_BASE_URL}`)" -# php: -# image: wodby/drupal-php:$PHP_TAG -# container_name: "${PROJECT_NAME}_php" -# environment: -# PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 -# PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S opensmtpd:25 -# DB_HOST: $DB_HOST -# DB_PORT: $DB_PORT -# DB_USER: $DB_USER -# DB_PASSWORD: $DB_PASSWORD -# DB_NAME: $DB_NAME -# DB_DRIVER: $DB_DRIVER -# PHP_FPM_USER: wodby -# PHP_FPM_GROUP: wodby -# COLUMNS: 80 # Set 80 columns for docker exec -it. -# # Read instructions at https://wodby.com/docs/stacks/php/local/#xdebug -# PHP_XDEBUG: 1 -# PHP_XDEBUG_DEFAULT_ENABLE: 1 -# PHP_XDEBUG_REMOTE_CONNECT_BACK: 0 -# PHP_IDE_CONFIG: serverName=my-ide -# PHP_XDEBUG_IDEKEY: "my-ide" -# PHP_XDEBUG_REMOTE_HOST: host.docker.internal # Docker 18.03+ Mac/Win -# PHP_XDEBUG_REMOTE_HOST: 172.17.0.1 # Linux -# PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS, Docker < 18.03 -# PHP_XDEBUG_REMOTE_HOST: 10.0.75.1 # Windows, Docker < 18.03 -# PHP_XDEBUG_REMOTE_LOG: /tmp/php-xdebug.log -# # PHPUnit Drupal testing configurations -# SIMPLETEST_BASE_URL: "http://nginx" -# SIMPLETEST_DB: "${DB_DRIVER}://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}#tests_" -# MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]' -# volumes: -# - ./:/var/www/html -## Alternative for macOS users: Mutagen https://wodby.com/docs/stacks/drupal/local#docker-for-mac -# - mutagen:/var/www/html -## For XHProf and Xdebug profiler traces -# - files:/mnt/files - - -# nginx: -# image: wodby/nginx:$NGINX_TAG -# container_name: "${PROJECT_NAME}_nginx" -# depends_on: -# - php -# environment: -# NGINX_STATIC_OPEN_FILE_CACHE: "off" -# NGINX_ERROR_LOG_LEVEL: debug -# NGINX_BACKEND_HOST: php -# NGINX_SERVER_ROOT: /var/www/html/web -# NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET -# # NGINX_DRUPAL_FILE_PROXY_URL: http://example.com -# volumes: -# - ./:/var/www/html -## Alternative for macOS users: Mutagen https://wodby.com/docs/stacks/drupal/local#docker-for-mac -# - mutagen:/var/www/html -# labels: -# - "traefik.http.routers.${PROJECT_NAME}_nginx.rule=Host(`${PROJECT_BASE_URL}`)" - mailhog: image: mailhog/mailhog container_name: "${PROJECT_NAME}_mailhog" labels: - "traefik.http.services.${PROJECT_NAME}_mailhog.loadbalancer.server.port=8025" - "traefik.http.routers.${PROJECT_NAME}_mailhog.rule=Host(`mailhog.${PROJECT_BASE_URL}`)" - + selenium: - image: "selenium/standalone-firefox${MOODLE_DOCKER_SELENIUM_SUFFIX}:2.53.1" + image: "selenium/standalone-firefox${MOODLE_DOCKER_SELENIUM_SUFFIX}:${MOODLE_DOCKER_BROWSER_TAG}" + #image: "selenium/standalone-firefox:latest" + #image: "selenium/standalone-chrome:latest" container_name: "${PROJECT_NAME}_selenium" volumes: - - "./web/html:/var/www/html:ro" + - "./web/html:/var/www/html" ports: - 5900:5900 - -# postgres: -# image: wodby/postgres:$POSTGRES_TAG -# container_name: "${PROJECT_NAME}_postgres" -# stop_grace_period: 30s -# environment: -# POSTGRES_PASSWORD: $DB_PASSWORD -# POSTGRES_DB: $DB_NAME -# POSTGRES_USER: $DB_USER -# volumes: -# - ./postgres-init:/docker-entrypoint-initdb.d # Place init file(s) here. -# - /path/to/postgres/data/on/host:/var/lib/postgresql/data # Use bind mount + - 4444:4444 # redis: # container_name: "${PROJECT_NAME}_redis" # image: wodby/redis:$REDIS_TAG -# adminer: -# container_name: "${PROJECT_NAME}_adminer" -# image: wodby/adminer:$ADMINER_TAG -# environment: -# # For PostgreSQL: -# # ADMINER_DEFAULT_DB_DRIVER: pgsql -# ADMINER_DEFAULT_DB_HOST: $DB_HOST -# ADMINER_DEFAULT_DB_NAME: $DB_NAME -# labels: -# - "traefik.http.routers.${PROJECT_NAME}_adminer.rule=Host(`adminer.${PROJECT_BASE_URL}`)" - pma: image: phpmyadmin/phpmyadmin container_name: "${PROJECT_NAME}_pma" @@ -179,10 +126,6 @@ services: # - "traefik.http.routers.${PROJECT_NAME}_solr.rule=Host(`solr.${PROJECT_BASE_URL}`)" -# memcached: -# container_name: "${PROJECT_NAME}_memcached" -# image: wodby/memcached:$MEMCACHED_TAG - # xhprof: # image: wodby/xhprof:$XHPROF_TAG # container_name: "${PROJECT_NAME}_xhprof" @@ -192,15 +135,6 @@ services: # labels: # - "traefik.http.routers.${PROJECT_NAME}_xhprof.rule=Host(`xhprof.${PROJECT_BASE_URL}`)" - portainer: - image: portainer/portainer - container_name: "${PROJECT_NAME}_portainer" - command: --no-auth -H unix:///var/run/docker.sock - volumes: - - /var/run/docker.sock:/var/run/docker.sock - labels: - - "traefik.http.routers.${PROJECT_NAME}_portainer.rule=Host(`portainer.${PROJECT_BASE_URL}`)" - traefik: image: traefik:v2.0 container_name: "${PROJECT_NAME}_traefik" @@ -211,17 +145,8 @@ services: - '33061:3306' # Database volumes: - /var/run/docker.sock:/var/run/docker.sock -# mutagen: -# build: -# context: . -# dockerfile: mutagen/Dockerfile -# init: true -# container_name: "mutagen" -# volumes: -# - mutagen:/var/www/html + #volumes: -## For macOS users (Mutagen) -# mutagen: ## For Xdebug profiler # files: diff --git a/phpcs.sh b/phpcs.sh new file mode 100755 index 0000000..84a2fd9 --- /dev/null +++ b/phpcs.sh @@ -0,0 +1,11 @@ +#!/bin/bash +CHECKPATH="web/html" +if [ "${1}" != "" ]; then + CHECKPATH="web/html/${1}" +fi + +./vendor/bin/phpcs --standard=PHPCompatibility \ + --runtime-set testVersion 7.3-8.1 \ + --extensions=php \ + --ignore=$CHECKPATH/local/codechecker/,$CHECKPATH/local/moodlecheck/,$CHECKPATH/node_modules/,$CHECKPATH/vendor/ \ + --cache=/tmp/cache -p $CHECKPATH diff --git a/phpdd.sh b/phpdd.sh new file mode 100755 index 0000000..edda9e2 --- /dev/null +++ b/phpdd.sh @@ -0,0 +1,10 @@ +#!/bin/bash +CHECKPATH="web/html" +if [ "${1}" != "" ]; then + CHECKPATH="web/html/${1}" +fi + +#./vendor/bin/phpdd scan -t 8.2 -a 8.1 -e codechecker,moodlecheck,node_modules,vendor $CHECKPATH +./vendor/bin/phpdd scan -t 8.1 -a 8.0 -e codechecker,moodlecheck,node_modules,vendor $CHECKPATH +./vendor/bin/phpdd scan -t 8.0 -a 7.4 -e codechecker,moodlecheck,node_modules,vendor $CHECKPATH +./vendor/bin/phpdd scan -t 7.4 -a 7.4 -e codechecker,moodlecheck,node_modules,vendor $CHECKPATH \ No newline at end of file diff --git a/setup.sh b/setup.sh index a39db40..31fe20b 100755 --- a/setup.sh +++ b/setup.sh @@ -12,3 +12,4 @@ mkdir "${WEB_PATH}/behatfaildumps" chmod 777 "${WEB_PATH}/behatfaildumps" mkdir mariadb mkdir mariadb-init +mkdir diffs