Skip to content

Instantly share code, notes, and snippets.

Avatar
🙉
unavailable

Luke Rodgers convenient

🙉
unavailable
View GitHub Profile
@convenient
convenient / gist:543c9752384a1fe005dc4ab60c3732bd
Last active October 1, 2021 09:59
Add stacktrace to all magento logs
View gist:543c9752384a1fe005dc4ab60c3732bd

vendor/magento/framework/Logger/Monolog.php

    public function addRecord($level, $message, array $context = [])
    {
        $context[uniqid('trace')] = (new \Exception())->getTraceAsString();
@convenient
convenient / README.md
Last active February 4, 2019 11:44
Magento 2 Commerce patch files for staging unit test date bug
View README.md
@convenient
convenient / file-test.php
Last active October 22, 2016 18:19
php-fpm libxml_disable_entity_loader
View file-test.php
<?php
error_reporting( error_reporting() & ~E_NOTICE & ~E_WARNING);
/**
* @param SimpleXMLElement|bool $element
* @return string
*/
function loadedOkay($element)
{
if ($element === true) {
@convenient
convenient / gist:9846247e14e3c0950994ed8bd0fcc1c7
Last active June 20, 2017 14:05
Group magento system log by frequency
View gist:9846247e14e3c0950994ed8bd0fcc1c7
cut -f 5- -d ':' /var/www/vhosts/project.com/var/log/system.log | sort -n | uniq -c | sort -nr | head -20
Get all 404 requests from log
`lecli query --loggroup bes_web --leql 'where(status=404 AND request!=/(.*?)favicon.ico/)' -r 'last 1 hour'`
`grep -Eo ".{0,255}query" 404.log | sed -e 's/\", "query//' | cut -d ":" -f9 | sed 's/^.//'`
cat reqs.log | sed -e 's/.*userAgent...//' -e 's/.referer.*..//'
View gist:d8aa9464e2ae03b4171056cf6e528bc3
select IF(count(schedule_id) = 0, 'stuck', 'okay') as crons from cron_schedule where finished_at is not null and finished_at >= DATE_SUB(NOW(), INTERVAL 2 HOUR);
@convenient
convenient / gist:459cbf6649bb73dd7343340cf6e145f8
Created May 3, 2016 10:12
apache access log group by iP
View gist:459cbf6649bb73dd7343340cf6e145f8
cat /var/log/httpd/access.SSL.log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20
@convenient
convenient / mage2
Last active February 3, 2017 08:39
PHPBREW Install php for Magento 1.x
View mage2
phpbrew install 5.3.26 +default +dbs +apxs2
phpbrew ext install iconv
phpbrew ext install gd
phpbrew ext install xdebug 2.2.3
#nano /home/luker/.phpbrew/php/php-5.3.26/var/db/xdebug.ini
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
@convenient
convenient / Price
Created December 11, 2015 13:10
Magento indexer changelog backlog
View Price
select count(*) from catalog_product_index_price_cl where version_id > (select version_id from enterprise_mview_metadata where changelog_name='catalog_product_index_price_cl');
@convenient
convenient / gist:5113999404d320e15424
Last active September 27, 2016 19:56
MD5 A directory
View gist:5113999404d320e15424
cd ~/path/to/folder/ && find . -name '*.php' | sort -d | xargs md5sum
#files with spaces
cd . && find . -name '*.mp3' | xargs -d '\n' md5sum | sort -k 3
@convenient
convenient / Mage_Core_Model_App.php
Created November 22, 2015 16:29
100 router match iterations
View Mage_Core_Model_App.php
protected function _initModules()
{
if (!$this->_config->loadModulesCache()) {
// Hacks start here!
$this->_config->setUseCache(false);
// Hacks end here!
$this->_config->loadModules();
if ($this->_config->isLocalConfigLoaded() && !$this->_shouldSkipProcessModulesUpdates()) {
Varien_Profiler::start('mage::app::init::apply_db_schema_updates');
Mage_Core_Model_Resource_Setup::applyAllUpdates();