register_activation_hook() not working


So I had an issue with my wordpress plugin not getting initialised properly, my activation hook was not working correctly. If you are in a hurry, my fix was this:

Make sure that the WP_PLUGIN_DIR does NOT have a trailing slash.

Yep, that’s it – two hours of my life tracking down Yet Another 1 Char Bug (I swear I have lost weeks of my life to bugs that are 1 character in nature!).

For more in depth trouble shooting, here are some things to know about the wordpress plugin activation process.

When you call register_activation_hook() it adds an action to the list with your callback associated with it. The action name is something like


If it working correctly it should appear as above, otherwise it will look something like


this is bad! The plugin_basename() function that is called has failed to match the WP_PLUGIN_DIR constant and remove it.

Here is the test plugin that I used to help me find the problem

Plugin Name: test tickles

syslog(LOG_ERR,'Testing @ ' . date('Y-m-d H:i:s') . ' ' . __FILE__);
syslog(LOG_ERR,'plugin base name = ' . plugin_basename(__FILE__));
register_activation_hook(__FILE__, function() {
    syslog(LOG_ERR,"Here is an error");

Needless to say, you should keep an eye on the syslog with this code

sudo tail -f /var/log/syslog

And then activate your plugin, if all goes to plan you should see

Here is an error

In your syslog file, if you do not – then you will see the plugin path and the path that plugin_bashname() thinks that it should be. If you see the whole path to your plugin – you now can go and fix it!

SVN Protocols and Non standard SSH ports

Here is an interesting thing I learnt today, you can create customer SVN protocol handlers. Why on earth would you want to do that? Well sometimes you want to use a non standard ssh setup!

you can define your non standard ssh protocol quite easily in the [tunnels] section of your ~/.subversion/config file. for example:

ssh1234 =  ssh -q -o ControlMaster=no -p1234

SSH pubkey fun

I had an interesting issue today where I was not able to use ssh key pairs to log into a box. It turns out that I had loose permissions on the home folder and ssh was silently failing.

So with that in mind, here is my guide to file system permissions for successful ssh authentication.

The home directory must not be writable for the world, but locking writes down to your user is probably a good thing too. the .ssh folder inside your home folder must be no looser than 0755 and the files inside .ssh *should* be 0600 to keep things nice and locked down tight.

chmod 755 /home/user
chmod 755 /home/user/.ssh
chmod 600 /home/user/.ssh/*

The home folder permissions is what tripped me up today, but a quick google and then chmod sorted that out for me.

Atlassian Jira/Crowd Troubleshooting

So Recently I had an issue with Atlassian Jira in which pages listing issues were not updating, but the issues themselves were.

Simple Resolution I thought as I removed backups from the previous year and freed up some disk space. I stopped Jira, with a

/etc/init.d/tomcat5.5 stop

Then removed the old backups and started jira again.

But that is when another problem arose – no one could log in! oh shite… how the hell do I fix this?!

It turns out that when you stop tomcat (and therefore Crowd)  Crowd writes out a config file, but since the disk was full, it could not write the file to disk!!! So, here is the file in question

ll ./atlassian/crowd/home/crowd.cfg.xml
-rw-r--r-- 1 tomcat55 nogroup 0 2011-06-15 10:42 ./atlassian/crowd/home/crowd.cfg.xml

See that 0 – that’s bad mkay. Luckily we have system backups and I skitched the file from there, stopped tomcat put the file in place and started it again.

we can now login – WOO fricken HOO… except where the heck are all of our issues?!

Here we go again. TM

The issues themselves are there but somehow the issues are no longer associated with their users.

This was easily enough resolved, I stopped tomcat, moved the old “jira.home” directory out of the way, created a new empty directory (assigning it the correct user permissions) and then restarted tomcat. This forced Jira to recreate a lot of things. After a few users browsed around in Jira for a bit the indexes were created again and all was good.

Side Note: The Opera web browser likes to cache things. If you are getting blank pages for your “Assigned to me” gadget, delete your cookies for your Jira installation, close your browser and start it again.

DNS Glue

So there is this wonderful thing called DNS Glue I learnt about the other day and it is used to break circular references in DNS entries.

What is a circular reference I hear you ask?

It is when a subdomain (such as ns1) is used to  tell there world where it’s parent is. The way DNS works when you ask for a domain is it starts at the TLD (say .com) and works its way down through the domain name. The first request is “where is .com”, the second is “Where is” and the third and final is “where is”. The problem here is is responsible for telling the world where to find

This is where DNS Glue comes in,  It tells the DNS system that “if you are looking for to look at this IP address here”.

To do this on planet domains is simple enough. Log into your account (if you are a whitelabel reseller, go to the user who has the domain and grab the login details and then go to your reseller site and log in). Once there, find the domain you want to add the DNS Glue to and click the plus symbol and add the domain and IP address to the “Child Name Servers” box and then you are golden.

I did have an issue with this though as I used the Planet Domain API to set this initially and it did not sync correctly with the registrar. From the reseller whitelabel admin I was able to use the “sync” button on the domains page to resync the planet domains database with the registrars version and then set it up again and it worked!

A couple of links that I found that were very helpful where

The case of the non working Munin Node Plugin

So I was attempting to get some nice munin graphs for my shiny new PowerDNS Authorative server and all the graphs were saying was NaN

So Naturally I logged in an tried running the command itself

root@ns1:~# munin-run pdns_queries-v1
recursing_answers.value 0
recursing_questions.value 0
tcp_answers.value 772
tcp_queries.value 772
udp_answers.value 9195
udp_queries.value 9195

So – things are running and returning… good, so I moved on to test it from the node and things were not so great

root@ns1:~# telnet localhost 4949
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
# munin node at ns1
fetch pdns_queries-v1

Interestingly enough I was not getting any errors in the logs either. After messing around with the script I figured out it was being run as “nobody” which is bad since nobody cannot run pdns_control and that kinda puts a limit on what can be done!

so, under /etc/munin/plugin-conf.d/munin-node I added a new section that told munin to run the command under the root user.

user root

And now it works and returns values!

iOS 5 Discussion Points #1

<Radix> So hang on.. photos you take get pushed to all other devices?
<Shorty> Radix: yeh
<Radix> lol.. I could see that being fun lol
<Radix> no more dirty pics on the iphone
<Shorty> that’s the best part
<Shorty> take pictures of a cock and it’ll appear on the missus phone
<Shorty> 😀
<Shorty> isn’t that what we all want?
<Shorty> 😀
<Boxie> hahahhaha