Skip to content

Instantly share code, notes, and snippets.

View twosg's full-sized avatar

Sven Geiß twosg

View GitHub Profile
@twosg
twosg / pt-duplicate-key-checker.sql
Created February 5, 2023 15:10 — forked from SchumacherFM/pt-duplicate-key-checker.sql
pt-duplicate-key-checker for Magento 1.8 MySQL database. Less indexes the faster the update/insert statement
# ########################################################################
# api2_acl_attribute
# ########################################################################
# IDX_API2_ACL_ATTRIBUTE_USER_TYPE is a left-prefix of UNQ_API2_ACL_ATTRIBUTE_USER_TYPE_RESOURCE_ID_OPERATION
# Key definitions:
# KEY `IDX_API2_ACL_ATTRIBUTE_USER_TYPE` (`user_type`)
# UNIQUE KEY `UNQ_API2_ACL_ATTRIBUTE_USER_TYPE_RESOURCE_ID_OPERATION` (`user_type`,`resource_id`,`operation`),
# Column types:
# `user_type` varchar(20) not null comment 'type of user'
@twosg
twosg / List of possible vulnerable Magento1 controllers.txt
Created May 27, 2019 12:45
List of possible vulnerable Magento1 controllers
/index.php/advancedreports/adminhtml_advancedreports/new
/index.php/advsubscribe/adminhtml_advsubscribe/index
/index.php/customerfollowup/adminhtml_customerfollowup/index
/index.php/superdeals/adminhtml_report_dealz/index
/index.php/feedbackpopup/adminhtml_feedbackpopup/index
/index.php/responsivebannerslider/adminhtml_responsivebannerslider/index
/index.php/realex/adminhtml_realex/index
/index.php/megamenuadmin/adminhtml_megamenu/index
/index.php/quicksee_admin/adminhtml_quicksee/index
/index.php/aitsys/index/index
@twosg
twosg / removeTestDataResetEntitySeries.sql
Created October 15, 2017 18:36 — forked from peterjaap/removeTestDataResetEntitySeries.sql
Remove orders, invoices, shipments, creditmemos, customers and quotes from Magento
# Empty relevant tables
DELETE FROM sales_flat_creditmemo;
DELETE FROM sales_flat_invoice;
DELETE FROM sales_flat_order;
DELETE FROM sales_flat_quote;
DELETE FROM sales_flat_shipment;
DELETE FROM customer_entity;
# Reset increment_ids
# Beware of store_ids when using multiple stores
@twosg
twosg / fooman-speedster-nginx.conf
Created September 25, 2017 20:43
Fooman Speedster Nginx
rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
location /lib/minify/ {
allow all;
}
Required Files:
app/code/Vendor/Modulename/etc/adminhtml/system.xml
app/code/Vendor/Modulename/etc/acl.xml
system.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd">
<system>
<!-- Add new Tab -->
<tab id="vendor" translate="label" sortOrder="300">
find . -type d -exec chmod 774 {} \;
find . -type f -exec chmod 664 {} \;

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@twosg
twosg / gist:4f0de8daf400124aa339
Last active April 23, 2020 15:12
Magento sorted model events
Original source: http://blog.mdnsolutions.com/index.php/magento-observer-events/
admin_roles_delete_after
admin_roles_delete_before
admin_roles_delete_commit_after
admin_roles_load_after
admin_roles_load_before
admin_roles_save_after
admin_roles_save_before
admin_roles_save_commit_after
INSERT INTO `cataloginventory_stock_item` (
`item_id` ,
`product_id` ,
`stock_id` ,
`qty` ,
`min_qty` ,
`use_config_min_qty` ,
`is_qty_decimal` ,
`backorders` ,
`use_config_backorders` ,
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE customer_address_entity;
TRUNCATE customer_address_entity_datetime;
TRUNCATE customer_address_entity_decimal;
TRUNCATE customer_address_entity_int;
TRUNCATE customer_address_entity_text;
TRUNCATE customer_address_entity_varchar;
TRUNCATE customer_entity;
TRUNCATE customer_entity_datetime;
TRUNCATE customer_entity_decimal;