This file contains hidden or 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 | |
/** | |
* how best to turn on errors for staging subdomains | |
* | |
* as this is in the index.php, performance is important, | |
* although technically the page will be cached | |
*/ | |
// 1. preg_match | |
if (preg_match('/^s1\.|^s2\.|^s3\.|^s4\.|^s5\.|^mac\.|^local\.|^mac-upgrade\./', $_SERVER['HTTP_HOST'])) { |
This file contains hidden or 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
/** | |
* Set developer mode and display_errors based on subdomain | |
*/ | |
$staging_subdomains = array( | |
's1', | |
's2', | |
's3', | |
's4', | |
's5', | |
'mac', |
This file contains hidden or 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
rsync \ | |
--verbose \ | |
--progress \ | |
--stats \ | |
--compress \ | |
--rsh=/usr/bin/ssh \ | |
--recursive \ | |
--times \ | |
--perms \ | |
--links \ |
This file contains hidden or 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
SELECT | |
sr.`name` as rule_name, | |
count(*) as total_orders, | |
SUM(sfo.`total_paid`) as revenue, | |
sr.`rule_id`, | |
sfo.`applied_rule_ids` | |
FROM | |
`sales_flat_order` sfo, | |
`salesrule` sr | |
WHERE |
This file contains hidden or 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
xdebug.remote_autostart=true | |
xdebug.remote_enable=1 | |
xdebug.collect_vars=on | |
xdebug.collect_params=4 | |
xdebug.show_local_vars=on | |
xdebug.var_display_max_depth=5 | |
xdebug.show_exception_trace=on |
This file contains hidden or 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 | |
$attribute_value = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue($productId, 'attribute_code', Mage::app()->getStore()); | |
echo $attribute_value; |
This file contains hidden or 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
# https://twitter.com/mrsopacua/status/447892121283223552 (@mrsopacua) | |
find app/design/frontend -type f -exec perl -ne 'while($_ =~ /(?<=\W)__\(\s*([\x27\x22])(.+?)\1\s*\)/g) { print "$2\n"; }' {} + |
This file contains hidden or 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
# /etc/logrotate.d/magento | |
"/path/to/site/var/log/*.log" | |
"/path/to/another-site/var/log/*.log" { | |
compress | |
copytruncate | |
daily | |
missingok | |
notifempty | |
olddir archive |
This file contains hidden or 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
-- http://www.mysqlperformanceblog.com/2008/02/04/finding-out-largest-tables-on-mysql-server/ | |
SELECT | |
CONCAT(table_schema, '.', table_name), | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, | |
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, | |
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, | |
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, | |
ROUND(index_length / data_length, 2) idxfrac | |
FROM | |
information_schema.TABLES |
This file contains hidden or 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 | |
// app/code/core/Mage/Sales/Model/Order.php | |
// comment the following lines arround ln.1272 | |
// if ($this->getEmailSent()) { | |
// return $this; | |
// } |