View hhvm_rhel7.md

Make sure you are sudo user before proceeding.

sudo -s
# rhel option rpms repos needed
subscription-manager repos p--enable=rhel-7-server-optional-rpms
# packages needed
yum install -y git svn cpp make autoconf automake libtool patch memcached \
bzip2 gcc-c++ cmake wget boost-devel mysql-devel pcre-devel gd-devel \
View 404.md

Get a list of 404s in the accesslogs:

sudo -s
grep "HTTP/1.1\" 404" /var/log/httpd/access_log | awk '{print $7 } ' | sort | uniq -c | sort -n > 404s.txt

another way

cut -d'"' -f2,3 /var/log/httpd/access_log | awk '$4=404{print $4" "$2}' | sort | uniq -c | sort -rg > 404s.txt
View remove customers and orders.sql
1 2 3 4 5 6 7 8 9 10
###
###
### ORDERS
###
###
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
View magento_date_fields_format.php
1 2 3 4 5 6 7 8 9 10
<?php
include 'app/Mage.php';
Mage::app();
// start store emulation
//$store_id = 17;
//$appEmulation = Mage::getSingleton('core/app_emulation');
//$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($store_id);
echo Mage::getSingleton('catalog/product_option_type_date')->getConfigData('date_fields_order');
View remove_attributes_inchoo_social_connect.php
1 2 3 4 5 6 7 8 9 10
<?php
include 'app/Mage.php';
Mage::app();
// remove incho social connect customer attributes
$codes[] = 'inchoo_socialconnect_gid';
$codes[] = 'inchoo_socialconnect_gtoken';
$codes[] = 'inchoo_socialconnect_fid';
$codes[] = 'inchoo_socialconnect_ftoken';
$codes[] = 'inchoo_socialconnect_tid';
View compare values across stores.sql
1 2 3 4 5 6 7 8 9 10
SELECT * FROM (
SELECT * FROM (
SELECT 'int' as t, catalog_product_entity_int.* FROM catalog_product_entity_int WHERE store_id IN (1,13) AND entity_id = 22205
ORDER BY store_id
) s
UNION ALL
SELECT * FROM (
SELECT 'datetime' as t, catalog_product_entity_datetime.* FROM catalog_product_entity_datetime WHERE store_id IN (1,13) AND entity_id = 22205
ORDER BY store_id
) s
View debugging reindex locks mysql commands.md

Sometimes you may have a run away reindex process that aborted due to a MySQL connection error of some sorts. It may be useful to use the following MySQL commands to aid in debugging.

Determining if a lock exists

Magento Enterprise labels the reindex lock via the constant REINDEX_FULL_LOCK in app/code/core/Enterprise/Index/Model/Observer.php

SELECT IS_FREE_LOCK('mydatabase_name.reindex_full')

Returns 1 is specified lock is free and can be acquired, 0 if it’s in use, NULL if an error occurs.

Determing the thread that is holding the lock

View category-path-skus-query.md

Find a list of magento sku's and the category paths they belong in via MySQL query.

SELECT product_id, sku, catid, cce.path FROM (
    SELECT entity_id as product_id, category_id as catid FROM (
        SELECT `e`.entity_id, `at_category_id`.`category_id` 
        FROM `catalog_product_entity` AS `e` 
        LEFT JOIN `catalog_category_product` AS `at_category_id`
        ON (at_category_id.`product_id`=e.entity_id)
    ) sub_query
) final_query
View hhvm_magento_setup.md

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
View delete a order.php
1 2 3 4 5 6
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::getModel('sales/order')->loadByIncrementId('200000065')->delete();
Something went wrong with that request. Please try again.