Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Running mysql on mamp localy

If you have more then one mysql installed on your computer and in your path is not proper MYSQL, you should run

?/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

Can't find a string to translate in drupal

This is kind of odd solution as it will confuse people.

"The t() function, to save on performance for single-language sites, won't store the string in the database until it is requested from another language. View the page in one of the non-default languages in order to populate the database (t() calls locale() to do this), thus making the string available for translation."

Enable errors and logging with drush or with settings.php

You have error, your site is not accessable and you need to see what is the problem but logging and errors are set to none.
Type this with drush

drush vset error_level x

Where x is 0/1/2, depending on what you want

0: none
1: errors and warnings
2: all

You can also do the same with settings.php, adding to it this

Stdin: is not a tty and other GIT problems when git clone

stdin: is not a tty
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
remote: Counting objects: 7844, done.

Finding ib_logfile0, ib_logfile1 and ibdata1 on MAMP

ib_logfile0
ib_logfile1
ibdata1

You will need this files, probably to delete them on MAMP/MAMP PRO when changing your "innodb_log_file_size" in my.cnf
Right location is very hard to find it is /Library/Application Support/appsolute/MAMP PRO/db/mysql

Drupal commerce checkout redirect pause

When using different payment methods for checkout, sometimes you will have a payment gateway that will redirect you to different page, like paypal. But what if you want to have your frontender a chance to look at a page before redirect to style it?

Git setup with hook for post-receive.

I have setup a simple git workflow.

In one directory on server I made bare repositroy

$ mkdir git-dir && cd git-dir
$ git init --bare

and in other one a folder for my live site

$ mkdir /var/www/www.example.com

then in the git-dir folder edit the post-receive hook

Checking my.cnf settings that are not set

On my WAMP, or MAMP or normal server you may wonder what are the settings for your MySQL that are not set in my.cnf file. There are lot of them and to get quick look at defaults all you need is to run query (you can run it in phpmyadmin for example)

show variables;

and you will have all the variables and their values shown.