Skip to content

Instantly share code, notes, and snippets.

@devzorg
devzorg / my.cnf
Created March 27, 2023 20:18 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@devzorg
devzorg / add-checkout-form-key.sh
Created May 25, 2018 11:26 — forked from schmengler/add-checkout-form-key.sh
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@devzorg
devzorg / patch-7136
Created January 11, 2018 14:03 — forked from molotovbliss/patch-7136
Magento v1 SUPEE-7136 Cookies : 'frontend_cid' is never renewed, compared to 'frontend' one. So session often expires.
Sauce: https://community.magento.com/t5/Technical-Issues/Cookies-frontend-cid-is-never-renewed-compared-to-frontend-one/td-p/41077
The core code seems to have forgotten to include the logic to renew the frontend_cid cookie.
I have contacted Magento support regarding this and they provided me a patch - SUPEE-7136, however I'm not seeing it published online anywhere...
The issue lies in this file:
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
What the patch does is replace this:
diff -rupN src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php
--- src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2016-02-17 19:27:54.000000000 +0100
+++ src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2017-05-04 16:36:44.349301447 +0200
@@ -114,7 +114,7 @@ class Mage_SalesRule_Model_Rule_Conditio
$attr = $this->getAttribute();
$total = 0;
foreach ($object->getQuote()->getAllVisibleItems() as $item) {
- if (parent::validate($item)) {
+ if (Mage_Rule_Model_Condition_Combine::validate($item)) {
$total += $item->getData($attr);
@devzorg
devzorg / magento_url_rewrite.patch
Created December 15, 2017 09:10 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));