常用命令
后台日志,常用于追踪代码:
\Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface')->addCritical('notice message', ['abc']);
查看当前开发模式:php bin/magento deploy:mode:show
切换默认模式:php bin/magento deploy:mode:setdefault
切换开发模式:php bin/magento deploy:mode:setdeveloper
切换生产模式:php bin/magento deploy:mode:set -s production
自动生成折扣码:php bin/magento queue:consumers:start codegeneratorProcessor
php bin/magento module:status<Vendor>_<Module>
php bin/magento module:disable <Vendor>_<Module>
php bin/magento module:enable <Vendor>_<Module>
发版本维护模式:
开启命令:php bin/magento maintenance:enable
关闭命令:php bin/magento maintenance:disable
查看状态:php bin/magento maintenance:status
自动生成折扣码:phpbin/magento queue:consumers:start codegeneratorProcessor
执行计划任务
php bin/magento cron:run --group="staging"
php bin/magento module:enable --all
常用的编译命令,如CA和US
#删除之前的编译文件
rd/s/q generated
rd/s/q pub\static\adminhtml
rd/s/q pub\static\frontend
rd/s/q var\view_preprocessed
rd/s/q var\cache
rd/s/q var\page_cache
#更新模块
php -dmemory_limit=2G bin/magento setup:upgrade
#编译文件
php -dmemory_limit=2G bin/magento setup:di:compile
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f fr_FR
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f fr_FR
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f es_MX
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f it_IT
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f de_DE
#西班牙
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f es_ES
#刷索引
php -d memory_limit=2G bin/magento indexer:reset
php -d memory_limit=2G bin/magento indexer:reindex
#刷缓存
php bin/magento cache:flush
#linux
rm -rf generated
rm -rf pub/static/adminhtml
rm -rf pub/static/frontend
rm -rf var/view_preprocessed
rm -rf var/cache
rm -rf var/page_cache
#更新模块
php -dmemory_limit=2G bin/magento setup:upgrade
#编译文件
php -dmemory_limit=2G bin/magento setup:di:compile
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f en_GB
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f it_IT
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f fr_FR
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f ja_JP
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f at_AT
#php -dmemory_limit=2G bin/magento setup:static-content:deploy -f es_MX
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f de_DE
#刷索引
php -d memory_limit=2G bin/magento indexer:reset
php -d memory_limit=2G bin/magento indexer:reindex
#刷缓存
php bin/magento cache:flush
#修改权限
chmod -R 777 pub/static/adminhtml
chmod -R 777 pub/static/frontend
chmod -R 777 var
chmod -R 777 generated
chmod -R 777 app/etc
chmod -R 644 app/etc/*.xml
chmod -R 777 vendor
service php-fpm restart
rm -rf pub/static/adminhtml
rm -rf pub/static/frontend
rm -rf generated
rm -rf var/view_preprocessed
rm -rf var/cache
rm -rf var/page_cache
/php -dmemory_limit=5G bin/magento setup:upgrade
php -dmemory_limit=5G bin/magento setup:di:compile
php -dmemory_limit=5G bin/magento setup:static-content:deploy -f
#php -dmemory_limit=5G bin/magento setup:static-content:deploy -f it_IT
php bin/magento cache:flush
chmod -R 777 pub/static/adminhtml
chmod -R 777 pub/static/frontend
chmod -R 777 generated
chmod -R 777 app/etc
chmod -R 644 app/etc/*.xml
chown -R www:www var
chown -R www:www generated
service php-fpm restart
禁用缓存
php bin/magento cache:disable
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento cache:status
php bin/magento cache:enable
#库存同步
/usr/local/php/bin/php -dmemory_limit=4G bin/magento indexer:reindex cataloginventory_stock
php -dmemory_limit=4G bin/magento redis:qty:init
Magento2开启异步下单步骤:
1、开启:bin/magento config:set dev/grid/async_indexing 1
2、刷缓存就可生效
php bin/magento cache:flush
chmod -R 777 pub/static/adminhtml
chmod -R 777 pub/static/frontend
chmod -R 777 var
chmod -R 777 generated
chmod -R 777 app/etc
3、执行php bin/magento cron:run
4、开启的过程中如何没有定时同步订单到sale order,可执行:
php bin/magento cron:run --group="default"
备注:上述开启后,执行php bin/magento cron:run,理应会定期同步了的
5、关闭:bin/magento config:set dev/grid/async_indexing 0
php -dmemory_limit=4G bin/magento cache:flush
php bin/magento cache:status 缓存状态
#商品图片重新生成,命令php bin/magento catalog:images:resize,之后刷索引缓存
开启异步索引
php -dmemory_limit=4G bin/magento config:set dev/grid/async_indexing 1 开启 (刷缓存可生效)
php -dmemory_limit=4G bin/magento config:set dev/grid/async_indexing 0 关闭
php bin/magento cron:run --group="default" 刷新
#执行计划任务:
php bin/magento cron:run --group="staging"
#刷索引:
php -dmemory_limit=4G bin/magento indexer:reset
php -dmemory_limit=4G bin/magento indexer:reindex
#缓存
php -dmemory_limit=4G bin/magento cache:flush
service php-fpm restart
前端编译:
英国(UK)
php -d memory_limit=2G bin/magento setup:static-content:deploy -f en_GB
日本(JP)
php -d memory_limit=2G bin/magento setup:static-content:deploy -f ja_JP
法国(FR)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f fr_FR
德国(DE)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f de_DE
意大利(IT)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f it_IT
阿拉伯 (AE)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f ar_SA
新加坡 (SG)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f en_US
澳办(AU)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f en_AU
南非(CO.ZA)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f en_US
墨西哥(MX)
php -dmemory_limit=2G bin/magento setup:static-content:deploy -f es_MX
添加账号:
sudo php bin/magento admin:user:create --admin-user="" --admin-password="xxx123456" --admin-email="xxx@qq.com" --admin-firstname="xxx" --admin-lastname="xxx"
指定用户加权限
sudo chown -R yuyu /mnt/ssd1/yuyu
刷计划任务:/home/scriptes/cron/cron
刷索引:/home/scriptes/cron/index
产品价格,在详情页面是OK的,在类目页面只有原价问题,记得,这是产品历史多站点问题,需要操作数据库把产品的历史多站点信息去掉,之后刷索引缓存:
TRUNCATE `catalog_product_entity_datetime`;
DELETE FROM `catalog_product_entity_decimal` where store_id != 0;
DELETE FROM `catalog_product_entity_int` where store_id != 0;
DELETE FROM `catalog_product_entity_media_gallery_value` where store_id != 0;
DELETE FROM `catalog_product_entity_media_gallery_value_video` where store_id != 0;
DELETE FROM `catalog_product_entity_text` where store_id != 0;
DELETE FROM `catalog_product_entity_varchar` where store_id != 0;
DELETE FROM `catalog_product_option_price` where store_id != 0;
DELETE FROM `catalog_product_option_title` where store_id != 0;
DELETE FROM `catalog_product_option_type_price` where store_id != 0;
DELETE FROM `catalog_product_option_type_title` where store_id != 0;
DELETE FROM `catalog_product_super_attribute_label` where store_id != 0;
更新版本号:
UPDATE setup_module
SET `data_version` = `schema_version`
WHERE
`module` IN (
'Amasty_Feed',
'Ebizmarts_MailChimp',
'Klarna_Core',
'Klarna_Ordermanagement',
'Klarna_Kp',
'Magento_PaypalReCaptcha',
'MSP_TwoFactorAuth',
'Mageplaza_GoogleRecaptcha',
'Mageplaza_SocialLogin',
'Mirasvit_Search',
'Mirasvit_SearchElasticNative',
'Olight_Queues',
'Olight_Homepage',
'Olight_Queues',
'Shippingx_Shiptheory',
'Silk_Bannerslider',
'Silk_Catalog',
'Silk_QtyCache',
'Silk_SocialLogin',
'Silk_Theme',
'Temando_Shipping',
'Vertex_Tax',
'Vertex_AddressValidation',
'Yotpo_Yotpo',
'Olight_Backend',
'Olight_Paypal',
'Olight_Shipping'
);
php artisan cache:clear
php artisan config:cache
批量生成优惠劵:
php bin/magento cron:run
php bin/magento queue:consumers:start codegeneratorProcessor
处理商城多站点信息步骤,建议先在对应的测试站点验证
1、类目
DELETE FROM `catalog_category_entity_datetime` where store_id != 0;
DELETE FROM `catalog_category_entity_int` where store_id != 0;
DELETE FROM `catalog_category_entity_text` where store_id != 0;
DELETE FROM `catalog_category_entity_varchar` where store_id != 0;
catalog_category_flat_store_1
catalog_category_product_index_store1
catalog_category_product_index_store1_replica
2、产品
TRUNCATE `catalog_product_entity_datetime`;
DELETE FROM `catalog_product_entity_decimal` where store_id != 0;
DELETE FROM `catalog_product_entity_int` where store_id != 0;
DELETE FROM `catalog_product_entity_media_gallery_value` where store_id != 0;
DELETE FROM `catalog_product_entity_media_gallery_value_video` where store_id != 0;
DELETE FROM `catalog_product_entity_text` where store_id != 0;
DELETE FROM `catalog_product_entity_varchar` where store_id != 0;
DELETE FROM `catalog_product_option_price` where store_id != 0;
DELETE FROM `catalog_product_option_title` where store_id != 0;
DELETE FROM `catalog_product_option_type_price` where store_id != 0;
DELETE FROM `catalog_product_option_type_title` where store_id != 0;
DELETE FROM `catalog_product_super_attribute_label` where store_id != 0;
catalog_product_index_eav
catalog_product_index_eav_replica
catalog_product_user_like
3、cms/block
DELETE FROM `cms_block_store` where store_id != 0;
DELETE FROM `cms_page_store` where store_id != 0;
\
select COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT,table_name from information_schema.COLUMNS where table_schema = 'de' AND DATA_TYPE LIKE '%tinytext%'
网友评论