For use after an upgrade to verify the correct working of Magento
- Activate all logs on the server (PHP, MySQL, Magento, mail, etc)
- Check meta tags in HTML
#Magento Cheat Sheet Code snippets for use in Magento.
##Base Methods
// Get Base URL
Mage::getBaseUrl();
// Get Base Directory
Mage::getBaseDir();
<?php | |
/** | |
* Categories Children count fix script. | |
* | |
* This scripts looks through all categories, compares the current children_count in database with the children_count as calculated in this script. | |
* If these values are different, the calculated values will be saved. | |
* | |
* Author: Fabio Ros - FROSIT | |
* Client: Seasight-Media | |
* |
** Command to list all infected files:
grep -lr --include=*.php "eval(base64_decode" /path/to/webroot
grep -lr --include=*.php "eval" .
grep -lr --include=*.php "base64" .
grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'
<?xml version="1.0"?> | |
<layout> | |
<default> | |
<action method="removeItem"> | |
<type>skin_js</type> | |
<name>js/slideshow.js</name> | |
</action> | |
<action method="addStylesheet"> | |
<type>skin_css</type> | |
<name>css/custom.css</name> |
#!/bin/bash | |
# Backup all databases | |
USER="XXX" | |
PASSWORD="XXX" | |
HOST="XXX" | |
now="$(date +'%d-%m-%Y')" | |
DATABASES=`mysql -u ${USER} -p${PASSWORD} -h ${HOST} -e "SHOW DATABASES;" | tr -d "| " | grep -v Database` | |
for db in ${DATABASES}; do |
Quick note on command options
Due to the earlier analysis phase of this set. There are some option embedded which are redundant to some commands. These options will show available, but won't do anything at some newer commands. They are mostly available to analysis and benchmark commands.
Sometimes redundant options
<?php | |
/** | |
* == MageLock == | |
* | |
* ~ Shows your Magento indexes' lock status. | |
* | |
* @description This file shows your index statuses and was meant to show when lock's became active or inactive. | |
* @warning DO NOT LEAVE THIS FILE ON PRODUCTION | |
* @note it requires the user to be logged in the backend for output to show, however this is not sufficient for proper security | |
* |
# Magento 1 Universal ignore V:1 ~ FROSIT.nl | |
# Project: ... | |
# IDE&OS files | |
.DS_* | |
*.swp | |
*.lock | |
__MACOSX | |
.idea | |
/nbproject/* |
#!/usr/bin/env php | |
<?php | |
/** | |
* Hash Tool | |
* ========= | |
* | |
* Small helper script to PHP's hash functions. | |
* | |
* @author Fabio Ros | |
* |