Magento 2 - SHOW TABLE STATUS Patch (en)
How to install our isTableExists() patch for MySQL
INFO: The patch below is already included in Magento 2.4.2 and later versions.
If you are running an online store with an earlier version of Magento, there are several methods for installing our performance patch for MySQL. For a secure installation of the update, we recommend installing it via Composer.
Composer method
For installation via Composer, the file composer-fasterisTableExists.diff.gz must be downloaded and unzipped into the patches/composer folder within the Magento root directory. If this folder does not yet exist, please create it beforehand.
This can be done via SSH using the following commands:
cd <MagentoStammverzeichnis>
mkdir -p patches/composer
curl
https://maxcluster.de/knowledge-base/downloads/fasteristableexists/composer-fasterisTableExists.diff.gz
> patches/composer/fasterisTableExists.diff.gz
gunzip patches/composer/fasterisTableExists.diff.gz
In order to install patches via Composer, you need the cweagans/composer-patches tool, which can be installed with the following command:
composer require cweagans/composer-patches
In the next step, expand the extra section of composer.json to install the patch. To do this, please add the following:
...
'extra': {
...
'composer-exit-on-patch-failure': true,
'patches': {
'magento/framework': {
'fasterisTableExists': 'patches/composer/fasterisTableExists.diff'
}
}
}
If you are using a build pipeline or managing composer.json in an external repository, please ensure that composer.json is also adjusted there so that the patch is applied in future deployments.
The patch can now be installed with the following command:
composer -v install
The output should confirm that the file vendor/magento/framework/DB/Adapter/Pdo/Mysql.php has been modified.
The output usually looks like this:
Gathering patches for root package.
Removing package magento/framework so that it can be re-installed and re-patched.
- Removing magento/framework (102.0.5)
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies.
It is recommended that you run `composer update` or `composer update <package name>`.
Dependency resolution completed in 0.026 seconds
Analyzed 1049 packages to resolve dependencies
Analyzed 6937 rules to resolve dependencies
Package operations: 1 install, 0 updates, 0 removals
Installs: magento/framework:102.0.5
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
Found 1 patches for magento/framework.
- Installing magento/framework (102.0.5): Loading from cache
Extracting archive - Applying patches for magento/framework
patches/composer/fasterisTableExists.diff (fasterisTableExists)
patch '-p1' --no-backup-if-mismatch -d
'/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/magento/framework'
<
'/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/patches/composer/fasterisTableExists.diff'
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- DB/Adapter/Pdo/Mysql.php 2020-06-04 17:19:28.439003997 +0200
|+++ DB/Adapter/Pdo/Mysql.php 2020-06-04 17:19:45.295945396 +0200
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
3 out of 3 hunks ignored
patch '-p0' --no-backup-if-mismatch -d
'/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/magento/framework'
<
'/var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/patches/composer/fasterisTableExists.diff'
patching file DB/Adapter/Pdo/Mysql.php
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
35 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Running PHPCodeSniffer Composer Installer
PHP CodeSniffer Config installed_paths set to
../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility,../../codeception
Using config file: /var/www/share/magento2-demoshop-maxcluster.de/2.3.5-p1/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
Config value 'installed_paths' updated successfully; old value
was
'../../codeception,../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility'
Note: The message ‘can't find file to patch at input line 3’ is normal and does not prevent the patch from being installed correctly.
Finally, the composer.lock-file must be updated, which can be done with the following command:
composer update --lock
Please note that this file must also be transferred to version control if necessary.
Please also remember to remove the patch from composer.json when updating to Magento 2.4.2.
Patch Method
As an alternative to the Composer method, it is also possible to install the patch directly.
To do this, the patch can be downloaded from the Magento root directory using the following command:
wget https://maxcluster.de/knowledge-base/downloads/fasteristableexists/fasterisTableExists.diff.gz
gunzip fasterisTableExists.diff.gz
It is then installed with this command:
patch -p0 < fasterisTableExists.diff
After installing the patch, you can remove the fasterisTableExists.diff file. Please note that this procedure must be repeated after every Magento update.
If you would like to learn more about Magento hosting at maxcluster, you can find all the information you need at maxcluster.de/en/magento-hosting.
If you require any further assistance, please contact our support team by phone at +49 5251/414130 or by email at support@maxcluster.de