This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep "HTTP\/...\" 404" nginx-access.log | awk '{ print $16}' | sort | uniq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getModel(" | |
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getResourceModel(" | |
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "Mage::getSingleton(" | |
find . -name "*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']" | |
find . -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape(" | |
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "htmlEscape(" | |
find ./app/code/local -name "*/Block/*.phtml" -print | xargs grep --color=auto -iRnH "SELECT.*FROM.*;[\"\']" | |
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "\$_[GET|REQUEST|SERVER|POST]" | |
find ./app/code/local -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct" | |
find . -name "*.php" -print | xargs grep --color=auto -iRnH "public _construct" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// I almost never use $installer = $this; instead I prefer to use the following | |
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup'); | |
// This is just an example of instantiating the setup class in the script. Of | |
// course I choose the appropriate setup class and resource on a case by case basis. | |
// That way it is very visible what setup class is being used. It can also be | |
// switched within a single setup script, for example to add attributes to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There's multiple reasons Magento's performance profile is different | |
than most "mid-2000s" LAMP stack frameworks and CMS systems. | |
1. SQL Bottleneck: Magento's functionality is implemented in such a | |
way that there's a large number of SQL queries on each page request. | |
Between the special EAV structure of product/category models, and a | |
general "model first" approach to development, you end up seeing a lot | |
of SQL queries. | |
2. "Classical" (Java/C#) style OOP. Magento uses a class heavy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'abstract.php'; | |
/** | |
* Generate a CSV of modules with admin routes that haven't implemented _isAllowed() | |
*/ | |
class Mpchadwick_Missing_Acl_Checker extends Mage_Shell_Abstract | |
{ | |
const MODULES_PATH = 'modules'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This rewrite modifies the caching behavior so that the layout cache key references a SHA1 | |
* hash of the layout XML instead of the XML itself to avoid duplication. The layout XML must | |
* still be generated once for each layout key, but it will not be saved if the identical | |
* contents already exist, saving considerable cache backend storage. | |
*/ | |
class Template_Core_Model_Layout_Update extends Mage_Core_Model_Layout_Update | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- copy this to YOUR_THEME.tmTheme--> | |
<dict> | |
<key>name</key> | |
<string>diff: deleted</string> | |
<key>scope</key> | |
<string>markup.deleted</string> | |
<key>settings</key> | |
<dict> | |
<key>background</key> | |
<string>#EAE3CA</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24-osx10.9-x86_64.tar.gz | |
tar xfvz mysql-5.6* | |
echo "stopping mamp" | |
sudo /Applications/MAMP/bin/stop.sh | |
sudo killall httpd mysqld | |
echo "creating backup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delimiter ;; | |
drop procedure if exists build_catalog;; | |
create procedure build_catalog(IN categories INT, IN products INT) | |
begin | |
SET @category_count = 1; | |
SET @CATNAMEPREFIX = "Category "; | |
SET @CATURLKEYPREFIX = "cat-"; | |
SET @CATURLPATHPREFIX = "catpath-"; | |
SET @ROOTCATEGORY = 2; | |
SET @INCLUDEINMENU = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate sample data and trigger Magento2 performance toolkit jMeter test plan. | |
HOST="magento2.loc" | |
BASE_PATH="/" | |
USERS=100 | |
RAMP_PERIOD=300 | |
LOOPS=1 | |
ADMIN_USER="magento2" | |
ADMIN_PASSWORD="magento2" |
OlderNewer