Analyze a platform

Events happening in the community are now at Drupal community events on www.drupal.org.
sime's picture

Hiya,

When I started Aegir I initially moved a lot of disparate sites onto the one platform. With each new Drupal release, and as we approach a stable Aegir release, I've been chipping away at standardizing my platforms.

One of the blockers is that some sites have modules in their site directory (eg. sites/blah.com/modules/somethingodd - ie. at the time it was easier to do it that way). Sometimes I decide to move this to sites/all, and sometimes there is a better alternative to install. Whatever the case i want to analyze the data efficiently.

The following snippet gives me a dump of all the module/theme info on the platform and puts it into a file called analysis.txt. It uses Drush HEAD (not sure when @sites feature was added).

drush @sites -y sqlq "SELECT s.name, s.filename, s.status, s.type, s.schema_version AS version, v.value AS site \
FROM system AS s JOIN variable AS v \
WHERE s.filename NOT LIKE 'modules/%' AND s.filename NOT LIKE 'themes/%' AND v.name = 'site_name'" > analysis.txt

I take the data and put it into a spreadsheet - best sort is by module name, then filename because you can see all the possible instances of a module or theme on the platform.

Hope this helps someone.

FYI: with regards to doing more with Drush on the command line you might look at this issue: http://drupal.org/node/875322

Comments

I'm interested in sharing

sime's picture

I'm interested in sharing tricks here, I'm happy to go into more detail about any other the above but not sure what interest there is.

if you care

adrian's picture

aegir generates drushrc.php files in the site and platform dirs.

these contain a 'packages' array, that is pretty much what file_scan_directory would create and also contains the parsed info file contents.

this is how aegir tracks and passes packages to the ui (where the same info is contained in a very denormalized set of tables).

oh. and another way

adrian's picture

the hosting/migrate/compare callback

it might be somewhat useful

ie: hosting/migrate/compare/$id1/$id2

theoretically you can compare any platform/site to another platform/site

YMMV.

Must play

sime's picture

Thanks Adrian, I will have a play with these. I've wondered that, because the drushrc file is already generated and Drupal can read them, whether you could write a cool analysis module that compares them.

Interesting one courtesy of

sime's picture

Interesting one courtesy of lyricnz, for analysing a single site. See the -e argument on the last grep allows filtering rows on multiple patterns. Doesn't show any site context for @sites though.

From within a site directory:

drush pm-list --status=enabled | grep -o '(.*)' | tr -d () | xargs drush pm-info | grep -e '^ Path' -e '^ Project'

Compare this with executing a query:

drush -y sqlq "SELECT s.name, s.filename, s.status, s.type AS version FROM system AS s WHERE s.filename NOT LIKE 'modules/%' AND s.filename NOT LIKE 'themes/%' ORDER BY s.filename"

Aegir hosting system

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: