Merge #17719 - Fix removing vendor folders (FAQ 1.44)
Pull-request: #17719 Ref: #16418 Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
commit
9278aeeba5
3
.github/workflows/other-tools.yml
vendored
3
.github/workflows/other-tools.yml
vendored
@ -70,9 +70,6 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install modules
|
||||
run: yarn install --non-interactive
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
|
||||
@ -24,7 +24,15 @@
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\": "libraries/classes"
|
||||
},
|
||||
"files": ["vendor/phpmyadmin/motranslator/src/functions.php"]
|
||||
"files": ["vendor/phpmyadmin/motranslator/src/functions.php"],
|
||||
"exclude-from-classmap": [
|
||||
"/test/",
|
||||
"/vendor/tecnickcom/tcpdf/tcpdf_barcodes_*.php",
|
||||
"/vendor/tecnickcom/tcpdf/tcpdf_import.php",
|
||||
"/vendor/tecnickcom/tcpdf/tcpdf_parser.php",
|
||||
"/vendor/tecnickcom/tcpdf/include/tcpdf_filters.php",
|
||||
"/vendor/tecnickcom/tcpdf/include/barcodes"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
18
doc/faq.rst
18
doc/faq.rst
@ -686,16 +686,20 @@ Some users have requested to be able to reduce the size of the phpMyAdmin instal
|
||||
This is not recommended and could lead to confusion over missing features, but can be done.
|
||||
A list of files and corresponding functionality which degrade gracefully when removed include:
|
||||
|
||||
* :file:`./vendor/tecnickcom/tcpdf` folder (exporting to PDF)
|
||||
* :file:`./locale/` folder, or unused subfolders (interface translations)
|
||||
* Any unused themes in :file:`./themes/`
|
||||
* :file:`./js/vendor/jquery/src/` (included for licensing reasons)
|
||||
* :file:`./js/line_counts.php` (removed in phpMyAdmin 4.8)
|
||||
* Any unused themes in :file:`./themes/` except the default theme `pmahomme`.
|
||||
* :file:`./libraries/language_stats.inc.php` (translation statistics)
|
||||
* :file:`./doc/` (documentation)
|
||||
* :file:`./setup/` (setup script)
|
||||
* :file:`./examples/`
|
||||
* :file:`./sql/` (SQL scripts to configure advanced functionality)
|
||||
* :file:`./js/vendor/openlayers/` (GIS visualization)
|
||||
* :file:`./examples/` (configuration examples)
|
||||
* :file:`./sql/` (SQL scripts to configure advanced functionalities)
|
||||
* :file:`./js/src/` (Source files to re-build `./js/dist/`)
|
||||
* :file:`./js/config/` (Configuration files to re-build `./js/dist/`)
|
||||
* Run `rm -rv vendor/tecnickcom/tcpdf && composer dump-autoload --no-interaction --optimize --dev` (exporting to PDF)
|
||||
* Run `rm -rv vendor/williamdes/mariadb-mysql-kbs && composer dump-autoload --no-interaction --optimize --dev` (external links to MariaDB and MySQL documentations)
|
||||
* Run `rm -rv vendor/code-lts/u2f-php-server && composer dump-autoload --no-interaction --optimize --dev` (U2F second factor authentication)
|
||||
* Run `rm -rv vendor/pragmarx/* && composer dump-autoload --no-interaction --optimize --dev` (2FA second factor authentication)
|
||||
* Run `rm -rv vendor/bacon/bacon-qr-code && composer dump-autoload --no-interaction --optimize --dev` (QRcode generation for 2FA second factor authentication)
|
||||
|
||||
.. _faq1_45:
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ while [ $# -gt 0 ] ; do
|
||||
git branch ci
|
||||
branch="ci"
|
||||
fi
|
||||
version="ci"
|
||||
version="${VERSION_SERIES}+ci"
|
||||
;;
|
||||
--help)
|
||||
echo "Usages:"
|
||||
@ -302,6 +302,42 @@ security_checkup() {
|
||||
fi
|
||||
}
|
||||
|
||||
autoload_checkup() {
|
||||
php <<'CODE'
|
||||
<?php
|
||||
|
||||
$classMapFiles = require __DIR__ . '/vendor/composer/autoload_classmap.php';
|
||||
|
||||
$foundFiles = 0;
|
||||
$notFoundFiles = 0;
|
||||
|
||||
foreach ($classMapFiles as $classMapFile) {
|
||||
if (! file_exists($classMapFile)) {
|
||||
echo 'Does not exist: ' . $classMapFile . PHP_EOL;
|
||||
$notFoundFiles++;
|
||||
continue;
|
||||
}
|
||||
$foundFiles++;
|
||||
}
|
||||
|
||||
echo '[autoload class map checkup] Found files: ' . $foundFiles . PHP_EOL;
|
||||
echo '[autoload class map checkup] NOT found files: ' . $notFoundFiles . PHP_EOL;
|
||||
$minFilesToHave = 1100;// An arbitrary value based on how many files the autoload has on average
|
||||
|
||||
if ($foundFiles < $minFilesToHave) {
|
||||
echo '[autoload class map checkup] The project expects at least ' . $minFilesToHave . ' in the autoload class map' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ($notFoundFiles > 0) {
|
||||
echo '[autoload class map checkup] There is some missing files documented in the class map' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
echo '[autoload class map checkup] The autoload class map seems okay' . PHP_EOL;
|
||||
CODE
|
||||
|
||||
}
|
||||
|
||||
# Ensure we have tracking branch
|
||||
ensure_local_branch $branch
|
||||
|
||||
@ -449,6 +485,10 @@ if [ -z "$PHP_REQ" ] ; then
|
||||
echo "Failed to figure out required PHP version from composer.json"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "* Writing the version to composer.json (version: $version)"
|
||||
composer config version "$version"
|
||||
|
||||
# Okay, there is no way to tell composer to install
|
||||
# suggested package. Let's require it and then revert
|
||||
# composer.json to original state.
|
||||
@ -456,7 +496,7 @@ cp composer.json composer.json.backup
|
||||
COMPOSER_VERSION="$(composer --version)"
|
||||
echo "* Running composer (version: $COMPOSER_VERSION)"
|
||||
composer config platform.php "$PHP_REQ"
|
||||
composer update --no-interaction --no-dev --optimize-autoloader
|
||||
composer update --no-interaction --no-dev
|
||||
|
||||
# Parse the required versions from composer.json
|
||||
PACKAGES_VERSIONS=''
|
||||
@ -470,7 +510,7 @@ done
|
||||
|
||||
echo "* Installing composer packages '$PACKAGES_VERSIONS'"
|
||||
|
||||
composer require --no-interaction --optimize-autoloader --update-no-dev $PACKAGES_VERSIONS
|
||||
composer require --no-interaction --update-no-dev $PACKAGES_VERSIONS
|
||||
|
||||
echo "* Running a security checkup"
|
||||
security_checkup
|
||||
@ -479,6 +519,15 @@ echo "* Cleaning up vendor folders"
|
||||
mv composer.json.backup composer.json
|
||||
cleanup_composer_vendors
|
||||
|
||||
echo "* Re-generating the autoload class map"
|
||||
# https://getcomposer.org/doc/articles/autoloader-optimization.md#what-does-it-do-
|
||||
# We removed some files, we also need that composer removes them from autoload class maps
|
||||
# If the class is in the class map (as explained in the link above) then it is assumed to exist as a file
|
||||
composer dump-autoload --no-interaction --optimize --dev
|
||||
|
||||
echo "* Running an autoload checkup"
|
||||
autoload_checkup
|
||||
|
||||
echo "* Running a security checkup"
|
||||
security_checkup
|
||||
if [ $do_tag -eq 1 ] ; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user