Drupal Dump

Drupal Snippets, Hacks and more....

495 posts since 2011

Drupal massive comment enable

When you enable, or dissable commenting in drupal, you will only affect new nodes, there is no bulk action for this in core (but it should be in my opinion, not every damn useful functionality does have to be in separate module). There are few ways to do it, some proper way would be to built action and then run VBO on nodes, but this is the most time consuming for sure.

Filefield paths best practices

Recently I had a site with +30 000 images, they were all in default drupal folder /files and ofcourse this started to make problems for my server but also if I wanted to manually do something, delete a file or use it this made that directroy unusable. So filefield paths (which should be in core) helps here.

Installing phpmyadmin to VPS/linux

You can manipulate your users and databases with SSH access, but then again its nicer and easier on the brain to make it trough visual interface (for most, some will probably work it faster in prompt). But for that you still need to install phpmyadmin through lines of SSH access.

Extracing tar files (without and with gzip or bzip) on Linux

When importing data you will probably be extracting or unpacking a tarball File
To unpack or extract a tar file, type:

tar -xvf file.tar

To save disk space and bandwidth files are saved using compression program such as gzip or bzip2. To extract / unpack a .tar.gz (gzip) file, enter (note -z option):

Archiving your files for migration /with folder exclussion

If you need to archive your files and you want to exclude some folders, for example "files" folder or some subfolders of files. You can use gzip for it

tar --exclude=sites/default/files/* --exclude=cache/* -cf file.tar . && gzip file.tar

And you will have a nice zip archive without folders you maybe don't want to transfer.

VPS LAMP stackscript additional settings to make it work

If you have some stackscript, like you might have on VPS like Linode, where you have automaticly installed some linux distribution like Debian, and then Apacher, PHP and MySQL are also installed, this will not work out of the box, you will still need to add some extra stuff on your VPS so you could install some drupal sites.