Skip to content

Instantly share code, notes, and snippets.

@esimonetti
Last active November 14, 2019 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esimonetti/06c153808a7c829b70a8ba522be7b761 to your computer and use it in GitHub Desktop.
Save esimonetti/06c153808a7c829b70a8ba522be7b761 to your computer and use it in GitHub Desktop.
Useful sugar file system commands to analyse an instance
# Quick way to tell the difference of the modules dir of two instances
# 1 - from within the vanilla system module's dir
cd modules
ls -la | awk '{ print $9 }' | grep -v '\.' | grep -v '\.\.' > ~/core_modules_dir.txt
# 2 - from within the customer system module's dir
cd modules
ls -la | awk '{ print $9 }' | grep -v '\.' | grep -v '\.\.' > ~/customer.txt
# 3 - diff the twos and do some fus to get the actual differences
diff -auNw ~/core_modules_dir.txt ~/customer.txt | grep + | grep -v "@" | cut -c 2- | grep -v "\+\+" | grep -v "\-\-"
# Find custom fields per module from the file system
cd cache/modules
find . -name *vardefs.php | xargs -I {} bash -c 'echo {} && grep custom_ {} | grep source | wc -l' | sed 's/ //g' | sed 'N;s/\n/ /' > ~/custom_fields_count.txt
# Find if there are any modules with role based views active
find ./custom * | grep -P "[a-f0-9\-]{36}" | grep -v history | grep -v working | grep -v "ext.php" | grep php
# Files that changed in the past 5 minutes
find . -mmin -5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment