This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get all stores where orders, invoices, etc use the wrong prefix | |
-- E.g. the '2' in order number '200002345' | |
SELECT store_id, prefix, entity_type, sequence_table FROM sales_sequence_meta | |
JOIN sales_sequence_profile ON sales_sequence_profile.meta_id = sales_sequence_meta.meta_id | |
WHERE prefix <> store_id | |
ORDER BY store_id; | |
-- Get all stores that use the wrong prefix autoincrement table for orders, invoices, etc. | |
-- E.g. the '2345' in order number '200002345' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete log files containing a certain string. | |
# Handy to clean up Magento reports after committing a fix. | |
find var/report/* -exec grep -q 'A non-numeric value encountered' '{}' \; -delete | |
# If you ant to chcek first: | |
find var/report/* -exec grep -q 'A non-numeric value encountered' '{}' \; -find |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loop though all rotated Directadmin access logs and get the top 20 list of User Agents | |
# This can be used to identify bots | |
zcat /home/USER/domains/DOMAIN/logs/LOGNAME.tar.gz* | awk -F\" '{print $6}' | sort | uniq -c | sort -nr | head -20 | |
# Get top 20 IP addresses | |
zcat /home/USER/domains/DOMAIN/logs/Feb-2019.tar.gz | awk -F\" '{print $1}' | sort | uniq -c | sort -nr | head -20 | |
# Get top 20 most visited URLs | |
zcat /home/USER/domains/DOMAIN/logs/Feb-2019.tar.gz | awk -F\" '{print $4}' | sort | uniq -c | sort -nr | head -20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force trailing slash for SEO purposes | |
RewriteEngine On | |
# For GET and HEAD requests only. We do not want to redirect posted forms and such, or we'll lose all POST data! | |
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$ | |
# Not for actual files. We do not want to redirect urls like test.jpg to test.jpg/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# Redirect to trailing slash if no slash is present in URI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getUtf8String($string) { | |
if ( !isUtf8($string) ) | |
return utf8_encode($string); | |
return $string; | |
} | |
function isUtf8($string) { | |
if ( function_exists("mb_check_encoding") ) { | |
return mb_check_encoding($string, 'UTF8'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function transcribe_cp1252_to_latin1($cp1252) { | |
return strtr( | |
$cp1252, | |
array( | |
"\x80" => "e", "\x81" => " ", "\x82" => "'", "\x83" => 'f', | |
"\x84" => '"', "\x85" => "…", "\x86" => "+", "\x87" => "#", | |
"\x88" => "^", "\x89" => "0/00", "\x8A" => "S", "\x8B" => "<", | |
"\x8C" => "OE", "\x8D" => " ", "\x8E" => "Z", "\x8F" => " ", | |
"\x90" => " ", "\x91" => "`", "\x92" => "'", "\x93" => '"', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all cached images older than 365 days | |
find ~/public/media/catalog/product/cache/* -type f -atime +365 -exec rm {} \; | |
# Remove product images that are not present in the database | |
magerun media:images:removeorphans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter input based on a whitelist. This filter strips out all characters that | |
* are NOT: | |
* - letters | |
* - numbers | |
* - Textile Markup special characters. | |
* | |
* Textile markup special characters are: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Inspect the default charset and collation for your database | |
SELECT default_character_set_name FROM information_schema.schemata WHERE schema_name = 'MYDATABASE_NAME'; | |
-- Alter the default charset and collation for your database | |
-- CAREFUL: when you change the charset for your database, make sure the data in your tables matches that character set. | |
-- If it is not, follow these steps: http://www.alphadevx.com/a/420-Converting-a-MySQL-database-from-latin1-to-utf8 | |
ALTER DATABASE MYDATABASE_NAME CHARACTER SET utf8 COLLATE utf8_general_ci; | |
-- Alter the default charset and collation for your database | |
ALTER TABLE MYTABLE_NAME CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############ Project specific rules ############### | |
# Project specific rules go here... | |
# To ignore a folder, add asterix -> folder/* | |
# This way, unignored files like .keep and .gitkeep will still be added to git | |
################# Global rules #################### | |
## Never ignore .gitignore | |
!.gitignore | |
## Dependencies |