Drupal Core Upgrade 7.20 to 7.21

Core update was released yesterday and since these generally address security issues, always a good idea to put it in place ASAP. Plus, then you won’t have to read all those warnings!

I have installed this on my sandbox and had no issues. I’m doing a reboot now and after checking the status report and a few of the features, i’ll install this on prod. I followed the same procedure as before. Here is the link. Will issue a Change Request when I am done.

Make note that I am on Centos 6.3 and the commands are specifically for this OS. BUYER BEWARE!

Install Centos Patches & Drupal Module Updates

There are nine patches available for my sandbox. Appears that they are already installed in prod since that environment is managed by Blackmesh.com. That’s fine but the environments need to be reconciled. There is also an update to the Welcome module for Drupal. Installing that in Sand, then Prod… Complete.

Aggregators, CRON Jobs and Drupal cleanup.

This was a really involved project. If you use the Aggregator Core module a lot, take a look. I depend on Aggregators more than anything right now and have really had to do some involved work with it. Read on:

I have aggregator needs that the core doesn’t really quite give me. but it does work pretty well. here is what I collect:

  • 50+ feeds from various newspapers culled hourly resulting in several hundred articles per day.
  • Each RSS source is categorized (automatically, by default in drupal) as z-Uncategorized which corresponds to a CID (in the drupal DB) of 22. 
  • As the articles come in, I review and categorize them. I have a shortcut to the z-uncategorized category of items. That gives me all the new items, regardless of the source in one place where I can categorize them quickly by clicking on the categorize tab provided by Core. I keep about 10% of the stories that come in.
  • Because the newspapers maintain articles in their RSS feeds for a period of time beyond my control, they are readded to drupal’s DB whenever the feed is pulled; but now listed with two categories. There are now two entries for each of these stories with the same IID but a different CID. It looks like this below. There is the default z-uncat… category and the Juvenile category that I chose before the feed was queried again.
  • Even thought this looks like one record, it is really two different records in the tables. So, if I look at the aggregator_category_item table, I can see two records for the one IID. One with CID of 22 (the default, z-uncategorized) and the other of whatever I assigned it to. So, I can run a query and delete all with category 22. But, until the newspaper removes it from THEIR feed, it continues to come through.
  • I perform a nightly clean up where I delete all the 22s. This occurs when the papers are slow and new items have all been categorized by me.
  • Eventually (after a few days for most news sources) the stories are removed from the papers’ RSS feeds and do not get repopulated in Drupal with the default of CID 22. So then I am left with a nice single record in the category that I have assigned it to. By cleaning up every night, I get rid of stale 22s as the newspaper removes them from their RSS feed and I don’t have to think about whether they still have it or not.

Image

This is the cron job that I have to do the clean up.

0 22 * * * /usr/bin/mysql –defaults-file=”/home/xxxx/.my.cnf_cron” -e “DELETE FROM drupal.aggregator_category_item WHERE aggregator_category_item.cid = 22” >>/dev/null 2>&1

The .my.cnf.cron file contains authentication information

[client]
host=localhost
user=crondel
password=*****

The user and password is a mysql specific user I created for this job.

The 0 22 * * * means that it will run at 10 PM EST every night. EST because that is the time zone for the server.

Here are the specific rights for the crondel account name for the drupal DB, named, drupal.

GRANT USAGE ON *.* TO ‘crondel’@’localhost’ IDENTIFIED BY PASSWORD ‘*6E52D2AA6010C379DE1AE3BC559E2416A9A5C513’
GRANT SELECT, DELETE ON `drupal`.`aggregator_category_item` TO ‘crondel’@’localhost’

The account needs SELECT rights to execute the WHERE condition of the SQL statement in addition to the DELETE FROM on the specific table in the DB.

You might ask, why not do all this with Feeds? Well, I did try to do it with Feeds. I spent quite a bit of time with it. But feeds grabs each RSS item as a node. And I could not figure out an easy way to categorize the hundreds of stories per day when they all come in as nodes. And since this DB will eventually be huge with 100k+ stories in a searchable archive, I think that it may be easier to keep it this way. I just had to figure out what to do with the extra 22s. And this solution seems to work.

Ug. This was a pain. And if you want to know more about the subject or I have been unclear, let me know and I’ll try to clarify.

Drush Command Line Utility

Today I am installing the Drush command line utility. This utility is described as a sort of “swiss army knife” on Drupal.org and is one of those utilities that I probably should have installed a while ago. I will also install the Colorbox image gallery today and will need Drush in the course of that install. More on Colorbox later.

The easiest way to install (if you’re on a unix/linux system) is to use the commands listed here. You should read all of this anyway if you want to get info on Drush.

pear channel-discover pear.drush.org
pear install drush/drush

From the linux command line (Centos6) as root. I ran these commands and bam. Drush was installed. There are also instructions on how to do this on Windows too.

On my Sand/Quality environments, I had to install Pear too. Prod had it – Prod was built by my hosting company, Blackmesh.com. Here is the easy way I did it:

#yum install php-pear

Then, I was able to use the commands above.

**One note, there is a “module” listed for Drush even though it really isn’t a mod. And when I tried to install it I got an error about the .info file. **

Production Change Request – Install OS Updates

This is one area of change management that is really backwards. because my hosting company is responsible for updating the OS on my server I don’t get a notification. so, i want to make sand/quality/prod the same so the patches are installed on prod first. but i am still going to follow the BPs and document the change. at least I don’t have to go in front of the Change committee anymore and have them pick it apart. Change Management in the corporate world can be such a pain….

so, here’s the proc:

yum update

confirm the new files

rpm -q centos-release

that last command must be run on sand and prod to ensure that the level is consistent.

Finishing up Environment Clean Up

All three of my environments now match completely. The Module Filter module helped me get them on the same page. So did the terminal command for listing the Centos patch level,

rpm -q centos-release

I also gave my VMs static addresses. and made host references so i can browse them by name. I have such a small network in my VO that I don’t need a dedicated DNS server. Ole Hosts is fine.

SSL on Production

I was able to install the SSL cert on prod in less than 5 minutes. that is the advantage of setting up a quality environment that truly matches prod; you can make the prod changes so easily and help keep your prod environment pristine.

now back to the multilingual stuff. i hate to get distracted but i really hate creds in clear text. ssl had to be done.