-
Notifications
You must be signed in to change notification settings - Fork 0
bricht/m2-snippets
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Code for reuse. 1. Import db 2. Change values in db: SELECT * FROM `core_config_data` WHERE `path` LIKE '%base_url%' ORDER BY `scope_id` LIMIT 50 SELECT * FROM `core_config_data` WHERE `path` LIKE '%catalog/search/engine%' ORDER BY `scope_id` LIMIT 50 SELECT * FROM `core_config_data` WHERE `path` LIKE '%catalog/search%' AND `path` LIKE '%hostname%' ORDER BY `scope_id` LIMIT 50 Disable merging and minifying locally update `core_config_data` set `value` = 0 where `path` IN('dev/js/merge_files','dev/css/merge_css_files','dev/js/minify_files','dev/css/minify_files'); Set local urls update `core_config_data` set `value` = 'http://local.yoursite.com/' where `path` IN('web/unsecure/base_url','web/secure/base_url'); Adding admin user admin:user:create --admin-user='jekabs' --admin-password='bryant4733' --admin-email='[email protected]' --admin-firstname='Admin' --admin-lastname='Admin' Set developer mode bin/magento deploy:mode:set developer Set redis info in env.php 'session' => [ 'save' => 'redis', 'redis' => [ 'host' => 'redis', 'port' => '6379', 'persistent_identifier' => '', 'password' => '', 'timeout' => '2.5', 'database' => '2', 'compression_threshold' => '2048', 'compression_library' => 'gzip', 'log_level' => '1', 'max_concurrency' => '6', 'break_after_frontend' => '5', 'break_after_adminhtml' => '30', 'first_lifetime' => '600', 'bot_first_lifetime' => '60', 'bot_lifetime' => '7200', 'disable_locking' => 1, 'min_lifetime' => '60', 'max_lifetime' => '2592000' ] ], 'cache' => [ 'frontend' => [ 'default' => [ 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => [ 'server' => 'redis', 'port' => '6379', 'persistent' => '', 'database' => '0', 'password' => '', 'force_standalone' => '0', 'connect_retries' => '1', 'read_timeout' => '10', 'automatic_cleaning_factor' => '0', 'compress_data' => '1', 'compress_tags' => '1', 'compress_threshold' => '20480', 'compression_lib' => 'gzip', 'use_lua' => '0' ] ], 'page_cache' => [ 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => [ 'server' => 'redis', 'port' => '6379', 'persistent' => '', 'database' => '1', 'password' => '', 'force_standalone' => '0', 'connect_retries' => '1', 'lifetimelimit' => '57600', 'compress_data' => '0' ] ] ] ], magento install dockergento magento setup:install --base-url=http://local.test.lv/ --base-url-secure=https://local.test.lv/ --db-host=db --db-name=test --db-user=root --db-password=password --admin-firstname=Magento --admin-lastname=User [email protected] --admin-user=jekabs --admin-password=bryant4733 --language=en_US --backend-frontname=admin --magento-init-params=MAGE_MODE=developer --use-secure=0 Optional params for ES --es-hosts="elasticsearch:9200" --es-user="username" --es-pass="password" Msql core_config_data dump docker exec viking_db_1 mysqldump -u root -ppassword vikingdb_jan core_config_data > local_ccd.sql Get query string from Framework/DB/Select with $query->assemble(); Or put echo $_productCollection->getSelect()->__toString(); in a template file. Switch to prod mode: dockergento magento deploy:de:set production --skip-compilation sudo rm -rf var/cache/* generated/* pub/static/* var/view_preprocessed/* var/page_cache/* var/generation/* dev/tests/integration/tmp/* sudo -u www-data php bin/magento setup:static-content:deploy lv_LV ru_RU et_EE lt_LT en_US --theme devall/hp sudo -u www-data php bin/magento setup:di:compile sudo -u www-data php bin/magento setup:static-content:deploy --theme Magento/backend Remove everything: rm -rf generated/code* generated/metadata/* pub/static/* var/cache* var/page_cache/* var/page_cache/* var/view_preprocessed/* DROP ALL TABLES First, disable foreign key check: echo "SET FOREIGN_KEY_CHECKS = 0;" > ./temp.sql Then dump the db with no data and drop all tables: mysqldump --add-drop-table --no-data -u root -p db_name | grep 'DROP TABLE' >> ./temp.sql Turn the foreign key check back on: echo "SET FOREIGN_KEY_CHECKS = 1;" >> ./temp.sql Now restore the db with the dump file: mysql -u root -p db_name < ./temp.sql UPDATE `customer_entity` SET `password_hash` = CONCAT(SHA2('xxxxxxxxOption123', 256), ':xxxxxxxx:1') WHERE `email` = '[email protected]'; DUMP mysqldump -u root -p magento2 -h 192.168.100.244 | gzip > ur_live-01-05-2020.sql.gz
About
reusable snippets
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published