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 | |
// shell/listAllCron.php | |
require_once 'abstract.php'; | |
class Mage_Shell_CronLister extends Mage_Shell_Abstract | |
{ | |
public function run() | |
{ | |
$cronJobs = Mage::app()->getConfig()->getNode('crontab/jobs'); |
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
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 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 | |
// Insert or read all data in one big batch, smallest possible number of queries. | |
// Sauce: http://inchoo.net/dev-talk/thou-shalt-not-do-inserts-in-a-foreach-unless-you-know-the-trick/ | |
/*** Speed tests say (time in seconds): | |
100 iterations 1000 iterations 10000 iterations | |
Insert multiple 0.017 0.079 0.379 | |
Foreach in a transaction 0.074 0.501 4.701 |
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 name, sku, sum(qty_ordered), sum(row_total) | |
FROM sales_flat_order_item | |
WHERE price > 0 | |
AND created_at > "2013-01-01 00:00:00" | |
GROUP BY sku | |
ORDER BY sku | |
LIMIT 1000 | |
# note created_at is in UTC |
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
Find all profiler entries in codebase: | |
`grep -l "Varien_Profiler" * -R > profiler.txt` | |
Find all profiler entries in codebase & remove. | |
`find . -type f -exec grep -qF 'Varien_Profiler' {} \; -exec sed -i '/Varien_Profiler/d' {} \;` | |
Sauce: https://magento.stackexchange.com/questions/121/what-parts-of-the-model-layer-can-be-bypassed-in-the-interest-of-performance-opt |
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
EXAMPLE: | |
echo Varien_Debug::backtrace(true, true); exit; | |
DECLERATION: | |
static method backtrace | |
Prints or return a backtrace | |
access: public | |
static string|bool backtrace ([bool $return = false], [bool $html = true], [bool $withArgs = true]) | |
bool $return: return or print |
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 | |
ob_implicit_flush(true); | |
umask(0); | |
set_time_limit(0); | |
ini_set('display_errors', 1); | |
$wsdlurl = 'http://example.com/api/soap?wsdl'; | |
$user = 'user'; | |
$key = 'password'; | |
$filename = './media/somefile.jpg'; |
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
<reference name="footer"> | |
<action method="unsCacheLifetime"></action> | |
</reference> |
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
# Generated with: | |
# SET SESSION group_concat_max_len = 999999999; | |
# SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) | |
# AS statement FROM information_schema.tables | |
# WHERE table_schema = 'databasename' AND table_name LIKE 'm2epro%'; | |
DROP TABLE m2epro_account, | |
m2epro_amazon_account, | |
m2epro_amazon_category, | |
m2epro_amazon_category_specific, |
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 @database, @old_prefix and @new_prefix (if you want a different prefix instead of removing) | |
# Execute the Generated SQL Query this generates to rename all tables found with prefix. | |
SET SESSION group_concat_max_len = 999999999; | |
SET @database = "databasename"; | |
SET @old_prefix = "mgn_"; | |
SET @new_prefix = ""; | |
SELECT GROUP_CONCAT("RENAME TABLE ", TABLE_NAME, " TO ", replace(TABLE_NAME, @old_prefix, @new_prefix),'; ' separator '') | |
FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database AND TABLE_NAME LIKE CONCAT(@old_prefix, '%'); |