Magento 2 Extensions Update
Magento 2 updates through Composer — the only supported way for core. Extension updates are more complex: vendors don't always support new versions synchronously, dependency conflicts are common. Proper order prevents data loss and wasted time.
Pre-update checks
# Current version
php bin/magento --version
# System status
php bin/magento setup:upgrade --dry-run
# Check dependencies without changes
composer why-not magento/product-community-edition 2.4.7
Magento Upgrade Compatibility Tool — official utility for code compatibility analysis:
composer create-project magento/upgrade-compatibility-tool uct --repository-url=https://repo.magento.com
cd uct
bin/uct upgrade:check /path/to/magento --coming-version=2.4.7
Report shows: deprecated API calls, removed classes, DB changes. Pay special attention to CRITICAL level — these will break after upgrade.
Backup
# Database
mysqldump -u root -p magento_db | gzip > /backups/magento_$(date +%Y%m%d).sql.gz
# Files (exclude cache and sessions)
tar --exclude='./var/cache' --exclude='./var/session' \
--exclude='./var/log' --exclude='./pub/media/catalog/product/cache' \
-czf /backups/magento_files_$(date +%Y%m%d).tar.gz -C /var/www/shop.com .
# Composer.json and composer.lock
cp composer.json /backups/composer.json.bak
cp composer.lock /backups/composer.lock.bak
Magento Core Update
# Enable maintenance mode
php bin/magento maintenance:enable
# Update core
composer require magento/product-community-edition=2.4.7 \
--no-update
# Update dependencies
composer update magento/product-community-edition \
--with-all-dependencies
# Run upgrade scripts
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy en_US -f
# Disable maintenance
php bin/magento maintenance:disable
php bin/magento cache:flush
For Magento Commerce (Adobe Commerce) process is same, just package differs: magento/product-enterprise-edition.
Extension Updates
# See available updates
composer outdated "magento/*"
composer outdated --direct
# Update specific extension
composer require vendor/module-name:"^2.1" --no-update
composer update vendor/module-name
# After extension updates — always
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
Version conflict problem. If composer update fails with dependency error:
# Diagnose conflict
composer why-not vendor/module-name 2.1.0
# Force update with conflict resolution
composer update vendor/module-name --with-dependencies
# If vendor didn't update — temporarily loosen constraint
# composer.json: "vendor/module-name": ">=1.5 <3.0"
Security Patches Check
Magento regularly releases Security Patches (APSB patches) between major releases:
# Install Quality Patches Tool
composer require magento/quality-patches
# List available patches
php ./vendor/bin/magento-patches status
# Apply specific patch
php ./vendor/bin/magento-patches apply MDVA-12345
# List applied patches
php ./vendor/bin/magento-patches status | grep Applied
Custom Extension Migration
If custom modules were developed — after core update check:
# Check module compatibility
bin/uct upgrade:check /path/to/magento \
--coming-version=2.4.7 \
--module-path=Vendor_MyModule
# Common issues after upgrade:
# 1. Deprecated __constructor injection → use factory
# 2. Removed ObjectManager::getInstance() → inject via DI
# 3. Changed interface → update implements
Performance After Update
# Full DI recompilation
php bin/magento setup:di:compile
# Deploy static for needed locales and themes
php bin/magento setup:static-content:deploy en_US \
--theme Magento/luma \
--theme Vendor/custom-theme \
-f
# Clear all caches
php bin/magento cache:clean
php bin/magento cache:flush
# Indexing
php bin/magento indexer:reindex
Automation via CI/CD
# .gitlab-ci.yml
magento-update:
stage: deploy
script:
- php bin/magento maintenance:enable
- composer update --no-dev --optimize-autoloader
- php bin/magento setup:upgrade --keep-generated
- php bin/magento setup:di:compile
- php bin/magento setup:static-content:deploy -f
- php bin/magento maintenance:disable
- php bin/magento cache:flush
only:
- tags
Flag --keep-generated preserves compiled files during setup:upgrade — speeds up production deploy, but requires pre-compilation on staging.
Timeline
Updating Magento 2.4.x to next minor version with staging testing — 1–2 days. With custom modules and complex dependencies — up to 3–4 days. Updating from outdated version (2.3.x → 2.4.x) — separate 1–2 week task.







