GIT - checking status of master and differences

Before final git pull to LIVE site, it is a good idea to check what is going to be pulled. So to do that

Git fetch
git diff master origin/master


git diff --name-only master origin/master

This should give you more insight on what is going to be pulled in the end, as this marks differences between current master branch on LIVE site and master on github.

Debugging ajax calls/requests

In case ajax calls are making a trouble and developer needs more information about what is happening regarding:

Dumping drupal DB without cache tables

If you want to dump DB from production or develop servers and not include cahce table values for faster importing you can use below script. You need to change site_name variable and DUMPDIR to match what you have and also user/password of DB

Bash script for cloning database on server

If you need to copy DB, lets say from production to develop you can use this script and call it like " original_db cloned_db"
For faster cloning it will exclude cache tables data.

Delete stale CSS and JS files faster

To delete stale CSS and JS files from server, you need to add

variable_set('drupal_stale_file_threshold', 86400);

to your settings.php and change the value from default 30 days (2592000) to for example 1 day above.
They will be deleted on cron run.

Importing zip mysql dump

zcat /Users/Marko/Downloads/file.sql.gz | mysql -u 'root' -p'password' your_database

just drop this line in your linux or mac and fill data you need to fill and wait :) or this for gz files

gunzip < /Users/Marko/Downloads/mydb.sql.gz | mysql -u root -p mydb

or for ZIP files

Git logs, find where it went wrong

When I want to find something in GIT and see who and when removed some code I start to search GIT, best command combo is this.

 git log -S "$location['country_code']" -p

For current branch

Logging mysql on localhost

In mysql 5.6+. Use this:

general_log = on

in your my.cnf / my.ini file