Dec. 3rd, 2011

Hooks

Dec. 3rd, 2011 05:32 pm
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)
[staff profile] denise
This came up in the previous questions post, and it's confusing enough that I thought I'd bring it up to a top-level post: hooks, and what to do if you see something in there that uses one but you can't figure out where the hook is.

LiveJournal uses a lot of hooks to pull ljcom (their equivalent of dw-nonfree) data into livejournal (their equivalent of dw-free) without hardcoding ljcom-specific things into livejournal. You'll see them called like this:

LJ::Hooks::run_hook( "hook_name" );


(sometimes with some other parameters added, or as a variable assignment). Some of them are also used in dreamwidth code: sometimes the hooks that were already defined in the code were useful for our purposes, or we wanted to do the same kind of thing with dw-nonfree code that was being done with ljcom code -- you'll find those in cgi-bin/DW/Hooks. I'd say probably about 90% of the hooks that are tied into the code aren't actually defined in either dw-free or dw-nonfree, though, because we just haven't needed them yet.

So, if you see a hook defined in the code, but you grep the code and nothing turns up for the hook name except the line that calls it -- it's probably an old ljcom hook that we haven't started using yet. You can look at ljcom's cgi-bin/LJ/Hooks directory, if you really are curious about what the hook is meant to do, but since ljcom is not free software, you can't and shouldn't copy the hook directly.

Profile

dw_dev_training: The stylised 'd', with the word 'dev' above, and the word 'training' at the side, representing the dw_dev_training comm. (Default)
Dreamwidth Development Training

September 2022

S M T W T F S
    123
45678910
1112131415 1617
18192021222324
252627282930 

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 7th, 2025 02:09 am
Powered by Dreamwidth Studios