Patch Applied in the di.xml file on Magento 2 Stores for MariaDB 10.5 Support

    July 1, 2022

    On the 27th of June Nexcess enabled a patch change made to the dependency injection file in Magento core which is named di.xml.


    The di.xml file is updated from a daily server cron so you do not have to modify the files since this is being taken care of automatically. The di.xml file change is a minor modification made to be able to support MariaDB 10.5.


    The change was made to be able to support MariaDB in Magento 2 core since the application does not support MariaDB 10.5 at the moment. Magento open-source has an open GitHub repository issue related to supporting MariaDB 10.5.


    If you are using version control for your Magento 2 store then it is possible to create a patch file that can be included in your composer.json file.


    To create a composer patch, you will need to generate diff outputs yourself. The reason for this is to ensure that the index ID in the resulting patch file matches up properly (using mine won’t work). Here is the diff output for app/etc/di.xml, along with the command to generate it. You will need to run this git diff command on your di.xml file AFTER the cron has modified it and BEFORE they reset it back to the original content in order to generate similar output:


    $ git diff app/etc/di.xml

    diff --git a/app/etc/di.xml b/app/etc/di.xml

    index 8605485..043cf12 100644

    --- a/app/etc/di.xml

    +++ b/app/etc/di.xml

    @@ -1834,7 +1834,7 @@

                 <argument name="supportedVersionPatterns" xsi:type="array">

                     <item name="MySQL-8" xsi:type="string">^8\.0\.</item>

                     <item name="MySQL-5.7" xsi:type="string">^5\.7\.</item>

    -                <item name="MariaDB-(10.2-10.4)" xsi:type="string">^10\.[2-4]\.</item>

    +                <item name="MariaDB-(10.2-10.5)" xsi:type="string">^10\.[2-5]\.</item>

                 </argument>

             </arguments>

         </type>


    The relative path for the patch to include would be similar to this example if you have created the patch from the root of the Magento store installed on the server;


    git diff app/etc/di.xml > ~/di_xml.patch


    MariaDB 10.5 offers improved database performance for your Magneto 2 store. For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.


    Useful Links

    https://developer.adobe.com/commerce/php/development/build/dependency-injection-file/

    https://github.com/magento/magento2/issues/31109

    https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

    https://mariadb.com/kb/en/changes-improvements-in-mariadb-105/

    https://www.atlassian.com/git/tutorials/saving-changes/git-diff

    https://getcomposer.org/doc/01-basic-usage.md

    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support