Use TIMESTAMPDIFF to identify long running cronjobs in Magento2

magento2_teaser_patch

Improving performance in cron jobs can be very time consuming. Even just figuring out where to start can take hours.

I came up with an idea that really helped me to locate potential performance killer just by checking the execution time by using TIMESTAMPDIFF. For example:

Output example:

The runtime can be a sign of high memory or CPU usage, therefore, you should probably look at those cron jobs first.

Warning: array_replace_recursive(): in Setup/Declaration/Schema/Diff/Diff.php

Magento2 Teaser

Today I’ve noticed an error during a test deployment that occurred right after setup:upgrade. Unfortunately it didn’t indicate the affected module.

I took a quick look at the recent changes and noticed a syntax error in db_schema_whitelist.json file. In this particular case it was a comma that shouldn’t be there.

Easy fix!

Before:

After:

After removing the comma, the deployment ran through gain.

Download Magento 1 Extensions after M1 EOL

Magento 1 Download Extension

Magento 1 extensions were removed from https://marketplace.magento.com about a month ago. According to Adobe’s recent blog posts, all extensions will be removed early August from their repository, which causes a lot of frustration on developers who are still in the middle of moving towards Magento 2 or simply need the code to translate it into Magento 2 modules.

Source: https://community.magento.com/t5/Magento-DevBlog/How-Extension-Developers-Can-Prepare-for-M1-End-of-Life/ba-p/446216

Source: https://magento.com/blog/magento-news/support-magento-1-software-ends-june-30-2020

So, in order to download an M1 package, you simply have to point to a specific URL. Luckily they didn’t turn off https://connect20.magentocommerce.com yet, but I believe Magento will get rid of it very soon.

I’ve spent a few minutes writing a ” quick and dirty ” PHP script that downloads the most recent version of each extension in https://connect20.magentocommerce.com/community/packages.xml including package details such as name, description, and author. For example https://connect20.magentocommerce.com/community/BankPayment/1.2.0/package.xml

If you download all packages, you will end up with about 1300 extensions.

However, it seems the packages.xml file contains a lot of extensions that are actually not available anymore, that leads to a 404.

Another good resource is https://packages.firegento.com or http://freegento.com/ddl-magento-extension.php to download M1 extensions.

Feel free to change or share the code.

Useful Postfix Commands

If your server is configured to send emails with postfix, you should be familiar with some basic Postfix commands without any help from your sysadmin.

1. List your default and custom settings

If you have added your custom Postfix settings or set your own email aliases with virtual_alias_maps, you will find it with postconf -n.

If you want to see your Postfix default settings, just change the parameter -n to -d.

It’s a good practise to keep this output as a running configuration snapshot in a simple text file in case you have any troubles with Postfix after server reboot or software updates.

2. List the current queue and email id’s

Check your postqueue frequently to make sure all your emails were delivered correctly. If everything is okay you will see the message “Mail queue is empty”. Otherwise, you will see a list of  undelivered emails.

3. Read emails from the queue

4. Delete emails from the queue