Archive for the ‘Uncategorized’ Category

Re: Using Redis as a Cache Backend in Magento

August 14th, 2013

The fine folks at the Magento ECG have published a nice article on using Redis as a cache backend in Magento. It provides some nice benchmarks and setup tips but there is one pretty major point where I disagree with their advice: using a single Redis instance. Here is why:
Read more…


Resolving Magento module dependencies without using the “depends” element

October 13th, 2011

You might someday (or perhaps you already have) come across a case where you want one module to be loaded after another module, but don’t necessarily want it to depend on the other module. Reasons might be that one config value should override another (such as a model/block/controller rewrite), or one layout should be applied after another (such as to remove a block added by the former). There might not actually be a dependence, or perhaps adding a dependence would create a circular dependency. There are two possible solutions for this:

  1. Merge the two (or more) module .xml files manually into one .xml file with the proper XML element order.
  2. Name the .xml files (or symlinks modman) such that they sort alphabetically in the proper order.

The element order within a single file will be stable (SimpleXML), and Magento loads the files alphabetically except that those beginning with Mage_ come first. Problem solved.



Now “My_Module” is loaded after “Their_Module” so I can override their config and/or layout without modifying their files and without My_Module depending on Their_Module!


Cross-SCM (git and subversion) projects with modman

March 3rd, 2011

I recently had a need to include some code from two subversion repositories in a git-based project. A bit of Googling brought me to the disappointing conclusion that there is no easy maintenance-free way of doing this with git.. Modman to the rescue! With a simple one-liner added to my modman file I can accomplish what is essentially an svn:externals declaration in my git-based project, or a subversion repository as a git submodule! Behold:

EDIT: Updated to use multi-line continuations for readability.

# Substitute for svn:externals
@shell \
  SRC=; \
  DEST=modules; \
  if [ -d $DEST/.svn ]; then \
    svn update $DEST; \
  else \
    svn checkout $SRC $DEST; \

# Import subversion-based modules
@import    modules/Foo
@import    modules/Bar

Now, when I clone the module (git is supported natively as of 1.1.0) or any time I run an update, deploy or repair, the subversion modules will be checked out or updated as well. So, if you ever need to mix and match SCM’s, go right ahead. I still recommend the use of git submodules for all-git projects and svn:externals for all-subversion projects, of course.

I’ll consider adding a builtin function that tidies up the above and handles things like switching urls..


The Right Way to Optimize Apache’s .htaccess Files

June 30th, 2010

While researching Magento performance optimizations you have probably already read about how to optimize Apache’s configuration by moving your configuration directives into the configuration files and out of the .htaccess files. Of course you need root to do this, but assuming you can, there are still very very wrong ways to do this that will result in no real performance gains, leave gaping security holes, and consume more time than necessary. Read on, a handy script for solving these problems and before and after performance benchmarks to prove the gains are included.

Read more…

Uncategorized , ,

My humble website is born…

September 11th, 2008

Ok, so what kind of web developer doesn’t have a website? Me, but not anymore. :)