Skip to content

Instantly share code, notes, and snippets.

Marko Martinović Marko-M

Block or report user

Report or block Marko-M

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Marko-M
Marko-M / gist:823ea02de09b8279aa36f6d26bf48688
Created Jul 2, 2018
SUPEE-10752 for Magento CE 1.9.3.8
View gist:823ea02de09b8279aa36f6d26bf48688
marko@marko-work ~/Desktop/magento $ grep -A 10 'function getVersionInfo' < app/Mage.php
public static function getVersionInfo()
{
return array(
'major' => '1',
'minor' => '9',
'revision' => '3',
'patch' => '8',
'stability' => '',
'number' => '',
@Marko-M
Marko-M / magento_bundle_product_type_price_indexer.sql
Last active Mar 28, 2018
Magento Bundle Product Type Price Indexer
View magento_bundle_product_type_price_indexer.sql
INSERT INTO `catalog_product_index_price_bundle_idx`
SELECT `e`.`entity_id`,
`cg`.`customer_group_id`,
`cw`.`website_id`,
IF(IF(Ifnull(tas_tax_class_id.value_id, -1) > 0, tas_tax_class_id.value, tad_tax_class_id.value) IS NOT NULL, IF(Ifnull(tas_tax_class_id.value_id, -1) > 0, tas_tax_class_id.value, tad_tax_class_id.value), 0) AS `tax_class_id`,
1 AS `price_type`,
IF(IF(IF(Ifnull(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) IS NULL, 1, IF(IF(Ifnull(tas_special_from_date.value_id, -1) > 0, tas_special_from_date.value, tad_special_from_date.value) <= cwd.website_date, 1, 0)) > 0
AND IF(IF(Ifnull(tas_special_to_date.value_id, -1) > 0, tas_special_to_date.value, tad_special_to_date.value) IS NUL
@Marko-M
Marko-M / nginx_access.log
Last active Nov 23, 2017
/checkout/cart/add/ DoS
View nginx_access.log
123.123.123.123 - - [23/Nov/2017:11:39:48 +0000] "POST /checkout/cart/add/uenc/xyz/product/142/form_key/CSLLfXodh1AqB5KK/ HTTP/1.1" 444 0 "http://www.example.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21"
234.234.234.234 - - [23/Nov/2017:11:39:48 +0000] "POST /checkout/cart/add/uenc/xyz/product/8086/form_key/CSLLfXodh1AqB5KK HTTP/1.1" 444 0 "http://www.example.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21"
123.123.123.123 - - [23/Nov/2017:11:39:48 +0000] "POST /checkout/cart/add/uenc/xyz/product/3734/form_key/CSLLfXodh1AqB5KK/ HTTP/1.1" 444 0 "http://www.example.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21"
123.123.123.123 - - [23/Nov/2017:11:39:48 +0000] "POST /checkout/cart/add/uenc/xyz/product/8086/form_key/CSLLfXodh1AqB5KK HTTP/1.1" 444 0 "http://www.example.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) Appl
View customer-install-0.1.0.php
<?php
/* @var $installer Mage_Customer_Model_Resource_Setup */
$installer = Mage::getResourceModel('customer/setup','customer_setup');
$installer->startSetup();
if (!$installer->getAttributeId('customer', 'attribute_name')) {
$installer->addAttribute('customer', 'attribute_name', array( // TABLE.COLUMN: DESCRIPTION:
/** Standard values defined @see Mage_Eav_Model_Entity_Setup::_prepareValues() */
'label' => 'Label', // eav_attribute.frontend_label admin input label
'backend' => 'module/class_name', // eav_attribute.backend_model backend class (module/class_name format)
@Marko-M
Marko-M / magento-nginx.conf
Created Dec 1, 2016 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
View magento-nginx.conf
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
@Marko-M
Marko-M / gist:c91895a815b3d89896196367206b1d74
Last active Sep 10, 2016
Vagrant sudo NOPASSWD (Ubuntu 16.04)
View gist:c91895a815b3d89896196367206b1d74
sudo -i
cat > /etc/sudoers.d/10_vagrant <<EOF
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD_CHECK = /etc/init.d/nfs-kernel-server status
Cmnd_Alias VAGRANT_NFSD_START = /etc/init.d/nfs-kernel-server start
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -r -e * d -ibak /*/exports
Cmnd_Alias VAGRANT_EXPORTS_REMOVE_2 = /bin/cp /*/exports /etc/exports
%sudo ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_EXPORTS_REMOVE, VAGRANT_EXPORTS_REMOVE_2
@Marko-M
Marko-M / gist:f9517c7acfcdff75e976d82fb750dbe3
Last active Jun 11, 2016
Vagrant 1.8.3 with Ubuntu 16.04 LTS
View gist:f9517c7acfcdff75e976d82fb750dbe3
#!/bin/bash
# Marko Martinović
# https://devgenii.com/
#
# Workaround for issue where Vagrant fails to install plugins due to RubyGems > v2.3.0 and Bundler Gem v1.12.0:
#
# ... `block in sort_dependencies': undefined method `payload' for nil:NilClass (NoMethodError)
#
# For example Vagrant 1.8.3 installed from .deb package @ HashiCorp website on Ubuntu 16.04 LTS.
@Marko-M
Marko-M / fpc-block-html-optimize.patch
Last active Mar 25, 2016
Magento improvement targeting FPC/block_html compatibility causing one cache storage access per layout block issue
View fpc-block-html-optimize.patch
--- app/code/core/Mage/Core/Block/Abstract.php 2016-03-25 14:22:51.934883000 +0100
+++ app/code/local/Mage/Core/Block/Abstract.php 2016-03-25 14:39:53.806883000 +0100
@@ -1,4 +1,17 @@
<?php
+/*
+ * Prevent unnecessary requests to cache storage on
+ *
+ * core_block_abstract_to_html_after
+ *
+ * due to
@Marko-M
Marko-M / magento-template-check.sh
Last active Feb 19, 2016
Magento Template Check
View magento-template-check.sh
#!/bin/bash
grep -Ein "get(Singleton|(Resource)?Model)" $(find -name "*.phtml")
@Marko-M
Marko-M / product_attribute_installer.php
Created Jan 21, 2016 — forked from antoinekociuba/product_attribute_installer.php
Magento Product Attribute installer script.
View product_attribute_installer.php
<?php
/**
* Product Attribute Installer
*/
try {
/* @var $installer Mage_Catalog_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
You can’t perform that action at this time.