Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Robbins steverobbins

View GitHub Profile
@steverobbins
steverobbins / magento-ioncube-module-info.php
Last active May 12, 2021
Display what information we can about Magento1 objects that are ioncubed (or any class really)
View magento-ioncube-module-info.php
<?php ini_set('display_errors', 1) ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<?php
// we need the autoloader
include 'app/Mage.php';
$classes = array(
View mezlan-magento-category-product-association-trigger.sql
create table trigger_execution_log (
id int not null auto_increment,
ran_at timestamp default current_timestamp,
trigger_name varchar(255) not null,
message varchar(255),
primary key (id)
);
DELIMITER $$
@steverobbins
steverobbins / 00-magento-session-db-gc-non-locking-readme.md
Last active Jan 18, 2021
Clean Magento's core_session table in background
View 00-magento-session-db-gc-non-locking-readme.md

Script to "safely" clean up the core_session table without causing lock wait timeouts.

Not thoroughly vetted but met the client's needs.

Requires disabling Mage_Core_Model_Resource_Session:gc(), e.g.

--- a/app/code/core/Mage/Core/Model/Resource/Session.php
+++ b/app/code/core/Mage/Core/Model/Resource/Session.php
@@ -74,7 +74,7 @@ class Mage_Core_Model_Resource_Session implements Zend_Session_SaveHandler_Inter
@steverobbins
steverobbins / archive.sh
Last active Apr 1, 2020
Quick and dirty script to save a whole site to archive.org
View archive.sh
#!/bin/bash
URL=$1
PATH=$2
EXCLUDE=$3
/bin/rm -rf "$URL"
echo "Gathering URLs..."
@steverobbins
steverobbins / Paypal.php
Last active Sep 23, 2019
PayPal API Requests
View Paypal.php
<?php
class Paypal
{
/**
* API Version
*/
const VERSION = 51.0;
/**
View magento-best-sellers.sql
select sfoi.sku, sum(sfoi.qty_ordered) sold, sum(sfoi.base_price) dollaramount
from sales_flat_order_item sfoi
group by sfoi.sku
order by sold desc
View magento-backup-db.sh
#!/bin/bash
################################################################################
# FUNCTIONS
################################################################################
# 1. Check required system tools
_check_installed_tools() {
local missed=""
View magento-report.php
<?php
$files = glob('*');
$reports = array();
foreach ($files as $file) {
if (!is_numeric($file)) {
continue;
}
$time = filemtime($file);
View magento-product-upsells.sql
select p1.sku `parent sku`, group_concat(p2.sku) `associated skus`, lt.code `type`
from catalog_product_link l
inner join catalog_product_entity p1 on p1.entity_id = l.product_id
inner join catalog_product_entity p2 on p2.entity_id = l.linked_product_id
inner join catalog_product_link_type lt on l.link_type_id = lt.link_type_id
group by l.product_id
View magento-backup.sh
#!/bin/bash
################################################################################
# FUNCTIONS
################################################################################
# 1. Check required system tools
_check_installed_tools() {
local missed=""