Skip to content

Instantly share code, notes, and snippets.

View SchumacherFM's full-sized avatar

Cyrill Schumacher SchumacherFM

View GitHub Profile
@SchumacherFM
SchumacherFM / magento-virgin-tables-1.7.0.2.sql
Created April 10, 2014 09:51
Magento DB Dump from version 1.7.0.2 and 1.8.1.0 for comparison
-- MySQL dump 10.13 Distrib 5.5.34, for osx10.6 (i386)
--
-- Host: localhost Database: magento-virgin
-- ------------------------------------------------------
-- Server version 5.5.34
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@SchumacherFM
SchumacherFM / pt-duplicate-key-checker.sql
Last active February 5, 2023 15:10
pt-duplicate-key-checker for Magento 1.8 MySQL database. Less indexes the faster the update/insert statement
# ########################################################################
# api2_acl_attribute
# ########################################################################
# IDX_API2_ACL_ATTRIBUTE_USER_TYPE is a left-prefix of UNQ_API2_ACL_ATTRIBUTE_USER_TYPE_RESOURCE_ID_OPERATION
# Key definitions:
# KEY `IDX_API2_ACL_ATTRIBUTE_USER_TYPE` (`user_type`)
# UNIQUE KEY `UNQ_API2_ACL_ATTRIBUTE_USER_TYPE_RESOURCE_ID_OPERATION` (`user_type`,`resource_id`,`operation`),
# Column types:
# `user_type` varchar(20) not null comment 'type of user'
@SchumacherFM
SchumacherFM / keybase.md
Created April 1, 2014 09:03
Keybase proof

Keybase proof

I hereby claim:

  • I am schumacherfm on github.
  • I am cyrill (https://keybase.io/cyrill) on keybase.
  • I have a public key whose fingerprint is 076A 9DCE D5C2 63EE 438B 2BF7 3D7A E252 C8C7 9677

To claim this, I am signing this object:

@SchumacherFM
SchumacherFM / OAuth.php
Created March 26, 2014 00:38
Magento 1.7 and maybe 1.8 OAuth redirect bug according http://www.magentocommerce.com/boards/viewthread/438434/ This solution integrates without any rewrites or overrides.
<?php
class Zookal_Customer_Model_Observer_Controller_OAuth
{
/**
* @param string $url
*
* @return bool
*/
@SchumacherFM
SchumacherFM / README.md
Last active September 21, 2018 10:05
Avoiding database deadlocks in Magento 1.7

After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.

1st Deadlock

Mage_Sales_Model_Abstract::_afterSave must be removed and replaced with afterCommitCallback. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.

2nd Deadlock

Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory() to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success.

@SchumacherFM
SchumacherFM / Stats.md
Last active October 9, 2018 05:47
Comparing different storage systems for Magento

Magento Caching Test

Testing three type of caches: persistent, non-persistent and two-level.

Prerequisites

  • MacBook Air
  • 13-inch, Mid 2012
  • Processor 1.8 GHz Intel Core i5
  • Memory 8 GB 1600 MHz DDR3
@SchumacherFM
SchumacherFM / Subscribe.php
Created December 19, 2013 01:05
Adding a simple block cache per customer to MageMonkey will improve the load of the Magento Checkout OnePage Review section after the first hit. Maybe the cache keys are not that optimal. As I have seen the code in line 41-48 I've started immediately to cry :-( License: GPL https://twitter.com/centerax/status/413285266996989952
<?php
/**
* Checkout subscribe checkbox block renderer
*
* @category Ebizmarts
* @package Ebizmarts_MageMonkey
* @author Ebizmarts Team <[email protected]>
*/
class Ebizmarts_MageMonkey_Block_Checkout_Subscribe extends Ebizmarts_MageMonkey_Block_Lists
@SchumacherFM
SchumacherFM / ace.js
Created October 25, 2013 02:46
Ace Editor (http://ace.c9.io/#nav=about) with Diff
/*
load js libs:
'/Resources/public/js/lib/ace/ace.js'
'/Resources/public/js/lib/ace/mode-diff.js'
'/Resources/public/js/lib/ace/theme-chrome.js'
https://github.com/Slava/diff.js/blob/master/diff.js
*/
var data = { /*json from server ... */
after: [
@SchumacherFM
SchumacherFM / arrayToInt.php
Created October 18, 2013 01:49
array_map('intval',...) vs arrayToInt()
<?php
$integers = range(100, 1000);
foreach ($integers as &$int) {
$int = (string)$int;
}
function arrayToInt(array $arr)
{