Skip to content

Instantly share code, notes, and snippets.

View peterjaap's full-sized avatar

Peter Jaap Blaakmeer peterjaap

  • elgentos ecommerce solutions / Blaakmeer Webdevelopment
  • Groningen, the Netherlands
View GitHub Profile
@peterjaap
peterjaap / ACSD-51892_2.4.6.patch
Created July 11, 2023 07:28
Drop-in ACSD-51892 patch for 2.4.6 / 2.4.6-p1 in vaimo/composer-patches format
@package magento/framework
@level 4
@version >=103.0.6 <103.0.7
diff --git a/vendor/magento/framework/App/DeploymentConfig.php b/vendor/magento/framework/App/DeploymentConfig.php
index 6713baa3a1d..64f32d5516b 100644
--- a/vendor/magento/framework/App/DeploymentConfig.php
+++ b/vendor/magento/framework/App/DeploymentConfig.php
@@ -51,6 +51,16 @@ class DeploymentConfig
*/
@peterjaap
peterjaap / n8n.php
Created March 28, 2023 12:34
Deployer task n8n webhook to update PHP packages Airtable. Set the webhook URL to the env var N8N_WEBHOOK_PACKAGES
<?php
desc('Send the composer.lock file to our n8n endpoint to save package information in our overview');
task('update-packages-overview', function () {
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => getenv('N8N_WEBHOOK_PACKAGES'),
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => file_get_contents('composer.lock'),
@peterjaap
peterjaap / PHP_packages_composer_lock_Magento_projects.json
Last active March 30, 2023 09:31
N8N.io Workflow PHP packages composer.lock Magento projects
{
"name": "PHP packages composer.lock Magento projects",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "24577e32-bda2-48d3-9721-509294f9cc89",
"options": {}
},
"id": "525eb7eb-bdcb-4a47-a5a1-dc84d166c8a3",
@peterjaap
peterjaap / varnish6.vcl
Last active March 13, 2024 21:57
Updated Magento 2 Varnish 6 VCL, in cooperation with Varnish Software
# A number of these changes come form the following PR's; , combines changes in https://github.com/magento/magento2/pull/29360, https://github.com/magento/magento2/pull/28944 and https://github.com/magento/magento2/pull/28894, https://github.com/magento/magento2/pull/35228, https://github.com/magento/magento2/pull/36524, https://github.com/magento/magento2/pull/34323
# VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 6
vcl 4.1;
import std;
# The minimal Varnish version is 6.0
# For SSL offloading, pass the following header in your proxy server or load balancer: '/* {{ ssl_offloaded_header }} */: https'
backend default {
.host = "/* {{ host }} */";
@peterjaap
peterjaap / server.security-txt
Last active November 13, 2022 19:10
Nginx rules for security.txt on Hypernode
# ~/nginx/server.security-txt
# Make Magento 2.4.x's security.txt available to the world
rewrite ^/.well-known/security.txt$ /securitytxt/index/securitytxt last;
rewrite ^/security.txt$ /securitytxt/index/securitytxt last;
@peterjaap
peterjaap / fix-order-invoice-confirmation-email-item-grid.sql
Last active November 9, 2022 19:35
These queries fix the order item list in customized order/invoice email templates. Basically you need to change order to order_id and invoice to invoice_id and add area="frontend" if it's not set. Check whether you need to fix it with the SELECT queries, run the UPDATE queries to fix them.
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%order=%';
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%invoice=%';
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%sales_email_order_items%' AND template_text NOT LIKE '%area="frontend"%';
SELECT COUNT(*) FROM email_template WHERE template_text LIKE '%sales_email_order_invoice_items%' AND template_text NOT LIKE '%area="frontend"%';
UPDATE email_template SET template_text = REPLACE(template_text, "order=$order", "order_id=$order_id") WHERE template_text LIKE '%order=%';
UPDATE email_template SET template_text = REPLACE(template_text, "invoice=$invoice", "invoice_id=$invoice_id") WHERE template_text LIKE '%invoice=%';
UPDATE email_template SET template_text = REPLACE(template_text, 'handle="sales_email_order_items"', 'area="frontend" handle="sales_email_order_items"') WHERE template_text LIKE '%sales_email_order_items%' AND template_text NOT LIKE '%area="frontend"%';
UPDATE email_template SET template_text = REPLACE
@peterjaap
peterjaap / Elastic-no-msi.patch
Created October 22, 2022 14:35
Patch elastic suite without msi
Removed dependency on MSI modules
@package smile/elasticsuite
@link https://github.com/Smile-SA/elasticsuite/issues/1222
diff --git src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/InventoryData.php src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/InventoryData.php
index ca4557d..f07e059 100644
--- src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/InventoryData.php
+++ src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/InventoryData.php
@@ -14,7 +14,6 @@
@peterjaap
peterjaap / fitchef-to-myfitnesspal.user.js
Created September 12, 2022 18:15
Fitchef to MyFitnessPal Greasemonkey script
// ==UserScript==
// @name Fitchef to MyFitnessPal
// @version 0.1
// @description Voeg link toe aaan Fitchef.nl om een recept aan MyFitnessPal toe te voegen
// @author Peter Jaap Blaakmeer
// @match https://fitchef.nl/weekschema/*/*
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// ==/UserScript==
@peterjaap
peterjaap / identify.php
Last active September 6, 2023 08:12
Identify used Magento 2 frontend extensions in a Luma install
<?php
// Run with the URL pointing to a require-config.js as the first argument;
// php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
$content = file_get_contents($argv[1]);
preg_match_all(
'/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m',
$content,
$matches
@peterjaap
peterjaap / move-duplicate-theme-files.sh
Created September 22, 2021 11:55
Magento 2 - move duplicate themes files to new theme
#!/bin/bash
# Move duplicate themes files to new theme
OLDVENDOR="Vendor"
NEWVENDOR="Newvendor"
NEWTHEMENAME="Themename"
find app/design/frontend ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD | cut -d' ' -f3 | while read a;
do