Support #19
open系统升级
Description
将系统版本从2.4.8-p2升级到2.4.8-p5
YS Updated by yong shi about 2 hours ago
- Status changed from New to In Progress
- % Done changed from 0 to 80
正是站升级顺序:
执行用户:schornstein-bremen
1.升级前备份命令:
LIVE_DIR="/home/schornstein-bremen/public_html/magento"
BACKUP_BASE="/home/schornstein-bremen/public_html/backup-before-248p5"
TS="$(date +%F_%H%M%S)"
BACKUP_DIR="${BACKUP_BASE}_${TS}"
cd "$LIVE_DIR" || exit 1
mkdir -p "$BACKUP_DIR"
cp -a composer.json "$BACKUP_DIR/composer.json"
cp -a composer.lock "$BACKUP_DIR/composer.lock"
tar -zcf "$BACKUP_DIR/vendor.tar.gz" vendor
echo "Backup saved to: $BACKUP_DIR"
ls -lh "$BACKUP_DIR"
2.执行命令
composer require magento/product-community-edition=2.4.8-p5 --no-update
COMPOSER_MEMORY_LIMIT=-1 composer update magento/product-community-edition --with-all-dependencies
如果显示模块被修改过,询问“Discard changes [y,n,v,d,s,?]?”时填“y”
3.查看版本:
composer show magento/product-community-edition | grep versions
composer show magento/framework | grep versions
composer show magento/security-package | grep versions
php bin/magento --version
正确显示如下:
product-community-edition = 2.4.8-p5
framework = 103.0.8-p5
security-package = 1.1.7-p5
Magento CLI = 2.4.8-p2
4.执行升级:
rm -rf generated/code/* generated/metadata/* var/cache/* var/page_cache/* var/view_preprocessed/*
php bin/magento maintenance:enable
php bin/magento setup:upgrade
如果报错“Cannot process definition to array for type tinyblob
Upgrade failed: Cannot process definition to array for type tinyblob”
执行如下命令:
php -r '
$env = include "app/etc/env.php";
$db = $env["db"]["connection"]["default"];
$pdo = new PDO(
"mysql:host={$db["host"]};dbname={$db["dbname"]};charset=utf8mb4",
$db["username"],
$db["password"]
);
$pdo->exec("ALTER TABLE sfg_anfrage_nl_v2 MODIFY file BLOB NOT NULL");
echo "done\n";
'
然后继续upgrade,没有错误继续下一步
5.部署站点:
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f en_US de_DE
php bin/magento cache:flush
php bin/magento indexer:reindex
php bin/magento maintenance:disable