Skip to content

Instantly share code, notes, and snippets.

@vpietri
vpietri / customer_reset_password.sql
Created July 13, 2016 08:22
Magento: Reset all customer password
UPDATE `customer_entity_varchar` caev
JOIN `customer_entity` ce ON ce.entity_id=caev.entity_id
JOIN `eav_attribute` ea ON ea.entity_type_id=ce.entity_type_id AND caev.attribute_id=ea.attribute_id
SET caev.value=MD5('admin123')
WHERE ea.attribute_code='password_hash';
@vpietri
vpietri / magento_config_rewrite.php
Created November 28, 2015 14:55
Get all rewrite from Magento config class
<?php
$mageConfig = Mage::getConfig();
$rewriteResume=array();
foreach($mageConfig->getNode('global') as $type) {
foreach($type as $groupTypeName=>$groupType ) {
foreach($groupType as $aliasGroupName=>$group) {
if($group->rewrite) {
$rewriteClasses = $group->rewrite->children();
@vpietri
vpietri / malware.php
Created October 21, 2015 10:59
Magento shell script to detect and neutralize malware injection code. By now work only for guruincsite. Should be set in a cronjob task.
<?php
require_once 'abstract.php';
/**
* Magento Malware Shell Script Check
*
* This file should be save in the shell directory of Magento
* Basic usage samples:
* php malware.php
-- Desactive simple product which configurable product is deactivated
-- Replace %ATTRIBUTE_ID% with id of the eav product attribute "status"
UPDATE catalog_product_entity_int cpei_s
JOIN catalog_product_entity cpe ON cpe.entity_id=cpei_s.entity_id AND cpei_s.attribute_id=%ATTRIBUTE_ID% AND cpei_s.store_id=0 AND cpei_s.value=1
JOIN `catalog_product_super_link` spsl ON spsl.product_id=cpe.entity_id
JOIN catalog_product_entity_int cpei ON spsl.parent_id=cpei.entity_id AND cpei.attribute_id=%ATTRIBUTE_ID% AND cpei.store_id=0 AND cpei.value=2
SET cpei_s.value=2
WHERE cpe.type_id='simple';
@vpietri
vpietri / Regex.php
Created July 28, 2015 09:19
Magento dataflow adapter class to get file by regex expression and can backup file
<?php
/**
* Magento Dataflow Adapter Regex Class
*
* @author Vincent Pietri <www.vincent-pietri.fr>
*/
class ADM_Dataflow_Model_Convert_Adapter_Regex extends Mage_Dataflow_Model_Convert_Adapter_Io
{
@vpietri
vpietri / datataflow.php
Last active June 19, 2020 16:09
Magento shell script to run dataflow from the command line
<?php
require_once 'abstract.php';
/**
* Magento Dataflow Shell Script
*
* This file should be save in the shell directory of Magento
* Basic usage samples:
* php dataflow.php
* php dataflow.php list

Multiple PHP version under Ubuntu 12.04

Update your machine

apt-get update
apt-get ugrade

Install some dependencies

apt-get install build-essential