Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / reindex_urls.php
Created March 19, 2015 07:59
[Magento] Missing Product Urls and remove some
<?php
if(php_sapi_name() != 'cli')
{
die('tzzzzzz aaaaaaah, tzzzzz aaaaah');
}
require_once('app/Mage.php');
Mage::app('admin');
@mklooss
mklooss / shop2date_customers2magento.sql
Created September 27, 2012 07:57
get Customers from Shop2Date for Magento
SELECT
email,
"base" as _website,
CASE country
WHEN "DE,DEU,276:Deutschland" THEN "eu"
WHEN "AT,AUT,040:Österreich" THEN "eu"
WHEN "CH,CHE,756:Schweiz" THEN "ch"
WHEN "BE,BEL,056:Belgien" THEN "eu"
WHEN "CY,CYP,196:Zypern" THEN "eu"
WHEN "CZ,CZE,203:Tschechien" THEN "eu"
@mklooss
mklooss / gist:3799823
Created September 28, 2012 13:22
Multistore Magento / File Owner Cache Problem
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@mklooss
mklooss / gist:3852036
Created October 8, 2012 11:31
nginx Configuration Magento
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 5h;
}
location ^~ /media/ {
expires max;
}
location ^~ /skin/ {
expires max;
@mklooss
mklooss / tartarus_backups.sh
Created October 18, 2012 06:39
Tartarus Create Backups Configs (with Froxlor)
#!/bin/sh
for profile in /etc/tartarus/webs/*.conf; do
/usr/sbin/tartarus $* "$profile"
done
@mklooss
mklooss / import.php
Created October 22, 2012 14:30
Magento MySQL Plain Attribute Option Import
<?php
$attribute_code = "attr_code";
$suffix = " cm";
$array = array(
"10","20","30"
);
/*do not change*/
@mklooss
mklooss / mysqldumper.sh
Last active October 12, 2015 19:48
MySQL Backups with mysqldumper
#!/bin/sh
# MySQL Account Data in ~/.my.cnf
BACKUPDIR="/home/backups/sql";
DBFILTER="(information_schema|performance_schema|mysql|dev|tmp|froxlor|test)";
MYSQLDUMP="$(which mysqldump) -e --opt --skip-add-locks";
DIRNAME=`date +%Y-%m-%d`;
MYSQL=$(which mysql);
TAR=$(which tar);
GZIP=$(which gzip);
@mklooss
mklooss / dev_delete_cache.sh
Created November 19, 2012 10:33
Magento/Shopware DevServer remove Old files
#!/bin/bash
echo "delete: Old Log Files"
if [ -d /var/customers/logs ]; then
touch /var/customers/logs
/usr/bin/find /var/customers/logs/ -depth -mtime +7 -exec rm '{}' \;
fi
SEARCH_DIR=/var/customers/webs
for web in $SEARCH_DIR/*; do
BASENAME=`basename $web`
@mklooss
mklooss / PaypalFraud.php
Last active October 13, 2015 12:08
Magento PayPal CronJob - Fraud False Positiv
<?php
class PaypalFraud
{
const PAYPAL_FRAUD_LOG = "paypal_cron_fraud.log";
public function changeFraudStatus()
{
$collection_of_orders = Mage::getModel('sales/order')->getCollection();
$collection_of_orders->addFieldToFilter('status',array('fraud', 'payment_review'));
@mklooss
mklooss / mailqcheck
Last active October 23, 2015 07:25
check mail queue (based on postfix setup), when there more than 20 mails in the queue send an alert
#!/bin/bash
GAWK=`which gawk`
if [ -z "$GAWK" ]; then
echo "install gawk"
echo "~# apt-get install gawk"
exit;
fi
mailq_count=`mailq | tail -n1 | /usr/bin/gawk '{print $5}'`