Add management command to find domains impacted by 502 bug

http://manage.dimagi.com/default.asp?126120
it looks like the apps and forms should fall out of scope so hopefully won't be too bad (though will certainly be a bit slow).