Skip to main content

Posts

Showing posts from January, 2015

Help, I' m leaking PHP memory!

While trying to find out why DraggableViews consumed a lot of memory and finally returned a WSOD in a View returning over 10 nodes, I found this brilliant presentation in slideshare and thought of sharing!Help, Im leaking PHP memory! from julien pauli By the way, Draggable Views used node_save() for each view result. Using node_save() in one single request for 64 nodes in a site where Search API reindexes multilingually each node is sure to take a lot of memory! I had to hack the code - since there was no proper way to override the saving call - and use Batch API instead to save the nodes.

Fixing the Drupal Dashboard (empty) bug

If you have ever used Drupal Core's Dashboard module and decided to give access to it to multiple roles, you might have seen that if the user doesn't have access to a dashboard block, it won't be invisible but instead it will be shown with a value of (empty). The following functions tries and succeeds in fixing this exact problem.

How to chmod 755 all directories but no file (recursively)?

This is just a small reminder of the great answer found at superuser.com/a/91938.
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:

find /path/to/base/dir -type f -exec chmod 644 {} +
Or, if there are many objects to process:

chmod 755 $(find /path/to/base/dir -type d) chmod 644 $(find /path/to/base/dir -type f)
Or, to reduce chmod spawning:
find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 find /path/to/base/dir -type f -print0 | xargs -0 chmod 644