pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
Res facta quae tamen fingi potuit ([personal profile] pauamma) wrote in [site community profile] dw_dev_training2011-11-21 05:27 pm
Entry tags:

Question thread #3

It's time for another question thread!

The rules:

- You may ask any dev-related question you have in a comment. (It doesn't even need to be about Dreamwidth, although if it involves a language/library/framework/database Dreamwidth doesn't use, you will probably get answers pointing that out and suggesting a better place to ask.)
- You may also answer any question, using the guidelines given in To Answer, Or Not To Answer.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2011-12-03 11:08 pm (UTC)(link)
It's ... complicated! Basically, any time there's anything that makes assumptions about account structure, or references specific communities on LJ that might not exist on other sites, or assumes things that might not exist elsewhere, it's generally done with a hook. (For a good example of where hooks are used on DW for those reasons, check out htdocs/community/index.bml in dw-free and cgi-bin/DW/Hooks/Community.pm in dw-nonfree: "oh crap! I need to use DW-specific comms in the code!")

In general, if you see a hook being called in the code but you can't find any place where the hook is actually defined, it's almost certainly a ljcom hook. You can check for it in the ljcom code, but you can't copy or use that code.

(ljcom is the LJ equivalent of dw-nonfree: it is source-available (for comparison) but not Open Source and other sites can't use it. livejournal is the LJ equivalent of dw-free, which is freely usable anywhere. When we forked from LJ, we were only legally permitted to use things in the livejournal repository, not livejournal + ljcom the way livejournal.com uses, which is one reason why there are features on livejournal.com that we don't have.)

In this case, yeah, I'd just go ahead and remove that hook call in the mood theme widget if you're working there, since there's no reason to have it other than for something we don't use. If someone needs a hook there again in the future, they can make a new one.
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2011-12-03 11:35 pm (UTC)(link)
Thanks for the explanation! It is especially useful b/c I had read the wiki page on hooks as well as the old LJ documentation on hooks, and I'd looked in places like cgi-bin/DW/Hooks to try to find where some of them were defined and was really frustrated when I couldn't find them anywhere. (lol, I did rgrep first and then when I couldn't find them was like, "BUT THE WIKI SAYS THAT HOOKS ARE DEFINED SOMEWHERE, THEY HAVE TO BE DEFINED SOMEWHERE!!!! AHHHHHHHHHHHHHH" *commence useless manual searching of file structure even tho I already confirmed it wasn't there with my rgrep search*)

I am curious: why is some of the DW code open source but the stuff in dw-nonfree isn't?
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2011-12-04 12:00 am (UTC)(link)
The stuff that's in dw-nonfree is basically the stuff that either a) we cannot legally redistribute (stuff where the licensing says that we can use it, we just can't redistribute it, and putting it in dw-free for other people to use is redistributing) or b) stuff that is part of our unique branding (the Tropospherical Red/Purple site schemes, our logos, etc). There's also some stuff in there that refers to DW-specific setup: the suggestions generator (posts to a specific DW comm that might not exist on other sites), some places on the site where we refer to DW specific comms (like the hook I mentioned earlier), some bits of our account structure (although most of the paid vs premium paid division is very "baked in" to the code, we do make at least a token effort to assume that other sites might have other account structures) -- stuff like that.
chagrined: Marvel comics: zombie!Spider-Man, holding playing cards, saying "Brains?" (brains?)

[personal profile] chagrined 2011-12-04 12:03 am (UTC)(link)
Thanks again for more explanation! :)
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2011-12-04 12:07 am (UTC)(link)
Anytime! No question too big, no question too small.