Skip to content

Instantly share code, notes, and snippets.

Avatar
🚬
Code, Eat, Sleep++;

Jared molotovbliss

🚬
Code, Eat, Sleep++;
View GitHub Profile
@jordanvector
jordanvector / magento-consumers-mysql-rabbit-env
Created Feb 4, 2021
Magento Env.php consumers mysql to rabbitmq
View magento-consumers-mysql-rabbit-env
'queue' => [
'amqp' => [
'host' => 'localhost',
'port' => '5672',
'user' => 'guest',
'password' => 'guest',
'virtualhost' => '/',
'ssl' => ''
],
'topics' => [
@peterjaap
peterjaap / DB_CLEANUP_WITH_QUOTE_TABLE.php
Last active Apr 13, 2020
Updated Magento 2 cleanup script for sensitive data in wishlist_item_option, quote_item_option AND order_item_option (not in original script). Also added try/catch block for unserializable data. See for more info https://support.magento.com/hc/en-us/articles/360040209352 and https://magento.com/security/hot-fix-available-cve-2019-8118
View DB_CLEANUP_WITH_QUOTE_TABLE.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\App\Bootstrap;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Query\Generator;
use Magento\Framework\DB\Select\QueryModifierFactory;
@mnapoli
mnapoli / README.md
Last active Oct 22, 2021
PrettyCI migration
View README.md

This page will help you run continuous integration for PHP CodeSniffer and PHP-CS-Fixer using GitHub Actions.

To setup GitHub Actions in your repository, create a .github/workflows/ci.yml file in your repository and commit it.

The content of that file depends on the tool you want to run, please read the examples below.

Note: the examples below are provided to get you started easily, it is possible you may need to adjust them to fit your project.

php-cs-fixer

@mpchadwick
mpchadwick / gist:d732c289120ef9955e77e5801dd2fc1d
Created Jan 28, 2020
preexisting-custom-layout-updates.sql
View gist:d732c289120ef9955e77e5801dd2fc1d
# Categories
SELECT
ea.entity_type_id,
ea.attribute_id,
eet.entity_type_code,
ccet.value
FROM eav_attribute ea
LEFT JOIN eav_entity_type eet
ON eet.entity_type_id = ea.entity_type_id
LEFT JOIN catalog_category_entity_text ccet
@wigman
wigman / Compress Magento media
Last active Aug 6, 2021
Compress Magento media from commandline
View Compress Magento media
# you need these installed if you want to:
sudo apt-get update
# resize images
sudo apt-get install imagemagick -y
# compress jpg and png files
sudo apt-get install jpegoptim optipng
# compress video's
sudo apt-get install ffmpeg
@rsisco
rsisco / gist:6deeb3209ec9a396c859ca249a9ab5fa
Last active Jan 11, 2021
Magento 2 - Identify gallery image files missing from filesystem
View gist:6deeb3209ec9a396c859ca249a9ab5fa
mysql -u <user> -p <db> -h <host> -e "SELECT distinct case when value like '/%' then concat('.',value) else value end FROM catalog_product_entity_media_gallery" | awk '{print $1}' | xargs ls | grep "cannot access"
@satishgumudavelli
satishgumudavelli / magento2preview.php
Created Nov 12, 2019
Magento 2 order,invoice,shipment,credit meno preview emails
View magento2preview.php
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = $bootstrap->getObjectManager();
@antoinekociuba
antoinekociuba / m2_clean_product_eav_values.sql
Created Nov 10, 2019
Magento 2 - Clean product EAV values (zombie product values, even if attribute(s) is/are not on concerned attribute set(s) anymore). Inspiration from https://github.com/magento/data-migration-tool/issues/598
View m2_clean_product_eav_values.sql
CREATE TABLE catalog_product_entity_int_old LIKE catalog_product_entity_int;
INSERT INTO catalog_product_entity_int_old SELECT * FROM catalog_product_entity_int;
DELETE FROM catalog_product_entity_int
WHERE value_id IN
(SELECT cpei.value_id
FROM catalog_product_entity_int_old cpei
WHERE cpei.attribute_id NOT IN
(SELECT eea.attribute_id
FROM eav_entity_attribute eea
@bjoern-flagbit
bjoern-flagbit / mysql-select-simples-not-assigned-to-parents.sql
Last active Feb 10, 2020
Magento2 - MySQL Select simples products not assigned to parents
View mysql-select-simples-not-assigned-to-parents.sql
SELECT * FROM `catalog_product_entity`
LEFT JOIN `catalog_product_entity_int` ON `catalog_product_entity`.`entity_id` = `catalog_product_entity_int`.`entity_id`
WHERE `catalog_product_entity`.`type_id` = 'simple' AND `catalog_product_entity_int`.`attribute_id` = (SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'visibility') AND `catalog_product_entity_int`.`value` = 1 AND `catalog_product_entity`.`entity_id` NOT IN
(
SELECT `product_id` FROM `catalog_product_super_link`
)
@pobegov
pobegov / convert_latin1_data_in_a_utf8_mysql_database_to_utf8mb4.php
Created Jul 4, 2019
Convert MySQL Database (tables and data) to UTF8MB4, where UTF8 data stored via latin1 connection
View convert_latin1_data_in_a_utf8_mysql_database_to_utf8mb4.php
<?php
/**
* Requires php >= 5.5
*
* Use this script to convert utf-8 data in utf-8 mysql tables stored via latin1 connection
* This is a PHP port from: https://gist.github.com/njvack/6113127
*
* BACKUP YOUR DATABASE BEFORE YOU RUN THIS SCRIPT!
*
* Once the script ran over your databases, change your database connection charset to utf8: