LiveJournal Server

Technical Info


Jesse Proulx <[email protected]>
Brad Fitzpatrick <[email protected]>

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no invariant sections, nor Front-Cover/Back-Cover Texts. A copy of the license is included in Appendix A


This documentation intends to cover everything related to installing, administrating, and programming the LiveJournal Server software.

Table of Contents

LiveJournal Server
I. Introduction to LiveJournal
1. What is LiveJournal?
2. The Story Behind LiveJournal
3. Why Use LiveJournal?
1. Features
4. Frank the Goat
II. LiveJournal Installation
5. Requirements
6. Perl
1. Installing Perl
2. Installing Perl Modules
7. General Setup
1. $LJHOME Environment Variable
2. Installing the files
8. Apache
1. Installation
1.1. mod_perl
1.2. Apache suEXEC Support
1.3. Virtual Hosts
2. Example httpd.conf
9. Configuring
1. $LJ:: Variables
1.1. User-Configurable
1.2. Auto-Configured
4. Configuring %LJ::DBINFO
5. Setting Capabilities
10. MySQL
1. Install MySQL
2. Create the LiveJournal Database
3. Populate the Database
11. Scheduling Maintenence tasks
12. Finishing Up
III. Customizing Your Installation
13. Using your own CVS directory
1. Adding & Overlaying
14. Using your own images and icons
1. Using
15. Customizing LJ's Content
1. Using site-specific text
16. Setting your own Limits
17. Setting Site-Specific Hooks
1. Writing Hooks
2. Hooks Reference
18. BML Schemes
1. Writing a BML Scheme
2. BML Template Reference
19. Running your own Maintanence Tasks
IV. Administering a LiveJournal Site
20. Creating Users
21. Capabilities Classes
1. Introduction
2. Setting Capabilities
3. Capabilities Reference
22. Administrating Privileges
1. Using privs effectively
2. A list of all Privs
23. The Administrative Console
1. Taking control of the Console
2. Console Command Reference
24. Banning Users
V. LiveJournal Features
25. Internal Support System
1. Introduction
26. Topics System
A. GNU Free Documentation License
12. How to use this License for your documents
The Better Markup Language
1. A Brief Tutorial
1. Introducing BML
1.1. Blocks
1.2. BML Files
2. Block Parameters
2.1. The DATA Block Parameter
2.2. Block Flags and Passing Multiple Parameters
2.3. Parameterized Output: Positional Parameters
3. Static Blocks
3.1. Fully-Static Blocks
3.2. Semi-static Blocks
4. A Full Example
2. BML Block Types
3. Core BML blocks
I. API Documentation
BML::self_link - Takes the URI of the current page, and adds the current form data to the url, then adds any additional data to the url.
BML::set_status - Takes a number to indicate a status (e.g. 404, 403, 410, 500, etc) and sets
LiveJournal Programming
I. Programming Guidelines
1. General
2. Security
3. Database
4. Performance & Scalability
5. Perl Style
6. Patches
II. Internals
7. Capabilities Classes
III. Client/Server Protocol
8. Client / Server Protocol - Quick Reference
1. Introduction to the Protocol
2. Working with Proxies
9. Authentication in the Client Server Protocol
1. Clear
2. HTTP Cookies
3. Challenge / Response
I. Flat Client/Server Protocol Reference
checkfriends - Mode that clients can use to poll the server to see if their friends list has been updated. This request is extremely quick, and is the preferred way for users to see when their friends list is updated, rather than pounding on reload in their browser, which is stressful on the serves.
editevent - Edit or delete a user's past journal entry
editfriendgroups - Edit the user's defined groups of friends.
editfriends - Add, edit, or delete friends from the user's friends list.
friendof - Returns a list of which other LiveJournal users list this user as their friend.
getchallenge - Generate a one-time, quick expiration challenge to be used in challenge/response authentication methods.
getdaycounts - This mode retrieves the number of journal entries per day. Useful for populating calendar widgets in GUI clients.
getevents - Download parts of the user's journal.
getfriendgroups - Retrieves a list of the user's defined groups of friends.
getfriends - Returns a list of which other LiveJournal users this user lists as their friend.
login - Log in to the server, while announcing your client version. The server returns with whether the password is good or not, the user's name, an optional message to be displayed to the user, and the list of the user's friend groups. (friend groups can also be retrieved using the getfriendgroups mode)
postevent - The most important mode, this is how a user actually submits a new log entry to the server.
sessionexpire - Expires one or more sessions that a user has active within the system. This can be used to log a user out of any browsers they are logged in from as well as to cancel any sessions created with the sessionexpire mode.
sessiongenerate - Generates a session that can be used to setup a cookie for accessing the site with a user's privileges.
syncitems - Returns a list (or part of a list) of all the items (journal entries, to-do items, comments) that have been created or updated on LiveJournal since you last downloaded them. Note that the items themselves are not returned --- only the item type and the item number. After you get this you have to go fetch the items using another protocol mode. For journal entries (type "L"), use the getevents mode with a selecttype of "syncitems".
II. XML-RPC Client/Server Protocol Reference
checkfriends - Checks to see if your friends list has been updated since a specified time.
consolecommand - Run an administrative command.
editevent - Edit or delete a user's past journal entry
editfriendgroups - Edit the user's defined groups of friends.
editfriends - Add, edit, or delete friends from the user's friends list.
friendof - Returns a list of which other LiveJournal users list this user as their friend.
getchallenge - Generate a server challenge string for authentication.
getdaycounts - This mode retrieves the number of journal entries per day.
getevents - Download parts of the user's journal.
getfriends - Returns a list of which other LiveJournal users this user lists as their friend.
getfriendgroups - Retrieves a list of the user's defined groups of friends.
login - validate user's password and get base information needed for client to function
postevent - The most important mode, this is how a user actually submits a new log entry to the server.
sessionexpire - Expires session cookies.
sessiongenerate - Generate a session cookie.
syncitems - Returns a list of all the items that have been created or updated for a user.
10. Supporting the Blogger API
11. Protocol Versions
12. Journal Item Meta-data
A. Frequently Asked Questions
IV. Making Journal Styles
13. Comparing Style Systems
14. Style System 1 (S1)
1. History & Motivations
2. Design Overview
B. S1 Variable Reference: Most Recent Entries
C. S1 Variable Reference: Calendar view
D. S1 Variable Reference: Day view
E. S1 Variable Reference: Friends View
V. Application Programming Interface
III. API Documentation
LJ::CleanHTML::clean - Multifaceted HTML parse function
LJ::Cmdbuffer::flush - flush up to 500 rows of a given command type from the cmdbuffer table
LJ::Cmdbuffer::get_property - get a property of an async job type, either built-in or site-specific
LJ::Memories::count - Returns the number of memories that a user has.
LJ::Memories::create - Create a new memory for a user.
LJ::Memories::delete_by_id - Deletes a bunch of memories by memid.
LJ::Memories::get_by_ditemid - Get memory for a given journal entry.
LJ::Memories::get_by_id - Get memories given some memory ids.
LJ::Memories::get_by_keyword - Get memories given a user and a keyword/keyword id.
LJ::Memories::get_by_user - Get memories given a user.
LJ::Memories::get_keyword_counts - Get a list of keywords and the counts for memories, showing how many memories are under
LJ::Memories::get_keywordids - Get all keyword ids a user has used for a certain memory.
LJ::Memories::get_keywords - Retrieves keyword/keyids without big joins, returns a hashref.
LJ::Memories::update_memory - Updates the description and security of a memory.
LJ::Memories::updated_keywords - Deletes memcached keyword data.
LJ::S1::get_themeid - Loads or returns cached version of given color theme data.
LJ::Talk::can_delete - Determines if a user can delete a comment or entry. Basically, you can delete anything you've posted. You can delete anything posted in something you own (i.e. a comment in your journal, a comment to an entry you made in a community). You can also delete any item in an account you have the "A"dministration edge for.
LJ::Talk::delete_thread - Deletes an entire thread of comments.
LJ::Talk::freeze_comments - Freezes comments. This is the internal helper function called by
LJ::Talk::freeze_thread - Freezes an entire thread of comments.
LJ::Talk::get_comments_in_thread - Gets a list of comment ids that are contained within a thread, including the
LJ::Talk::get_talk2_row - Gets a row of data from talk2.
LJ::Talk::screening_level - Determines the screening level of a particular post given the relevent information.
LJ::Talk::unfreeze_thread - unfreezes an entire thread of comments.
LJ::User::dudata_set - Record or delete disk usage data for a journal
LJ::User::mogfs_userpic_key - Make a mogilefs key for the given pic for the user
LJ::_friends_do - Runs given sql, then deletes the given userid's friends from memcache
LJ::_get_rel_memcache - Helper function: returns memcached value for a given (userid, targetid, type) triple, if valid
LJ::_mod_rel_multi - Sets/Clears relationship edges for lists of user tuples.
LJ::_set_rel_memcache - Helper function: sets memcache values for a given (userid, targetid, type) triple
LJ::accept_comm_invite - Accepts an invitation a user has received. This does all the work to make the
LJ::acct_code_check - Checks the validity of a given account code
LJ::acct_code_decode - Breaks an account code down into its two parts
LJ::acct_code_encode - Given an account ID integer and a 5 digit auth code, returns a 12 digit account code.
LJ::acct_code_generate - Creates invitation code(s) from an optional userid for use by anybody.
LJ::acid_decode - Given an acid encoding from LJ::acid_encode, returns the original decimal number.
LJ::acid_encode - Given a decimal number, returns base 30 encoding using an alphabet of letters & numbers that are not easily mistaken for each other.
LJ::activate_userpics - Sets/unsets userpics as inactive based on account caps
LJ::add_friend - Simple interface to add a friend edge.
LJ::ago_text - Converts integer seconds to English time span
LJ::alldateparts_to_hash - Given a date/time format from MySQL, breaks it into a hash.
LJ::approve_pending_member - Approves someone's request to join a community. This updates the authactions table
LJ::are_hooks - Returns true if the site has one or more hooks installed for the given hookname.
LJ::auth_okay - Validates a user's password. The "clear" or "md5" argument must be present, and either the "actual" argument (the correct password) must be set, or the first argument must be a user object ($u) with the 'password' key set. Note that this is the preferred way to validate a password (as opposed to doing it by hand) since this function will use a pluggable authenticator if one is defined, so LiveJournal installations can be based off an LDAP server, for example.
LJ::auto_linkify - Takes a plain-text string and changes URLs into <a href> tags (auto-linkification)
LJ::bad_input - Returns common BML for reporting form validation errors in a bulletted list.
LJ::blocking_report - Log a report on the total amount of time used in a slow operation to a remote host via UDP.
LJ::can_manage - Given a user and a target user, will determine if the first user is an admin for the target user.
LJ::can_manage_other - Given a user and a target user, will determine if the first user is an admin for the target user, but not if the two are the same.
LJ::can_use_journal -
LJ::can_view - Checks to see if the remote user can view a given journal entry. Note: This is meant for use on single entries at a time, not for calling many times on every entry in a journal.
LJ::canonical_username -
LJ::check_form_auth - Verifies form authentication created with LJ::form_auth.
LJ::check_priv - Check to see if a user has a certain privilege.
LJ::check_referer - Checks if the user is coming from a given URI.
LJ::check_rel - Checks whether two users are in a specified relationship to each other.
LJ::clear_caches - This function is called from a HUP signal handler and is intentionally very very simple (1 line) so we don't core dump on a system without reentrant libraries. It just sets a flag to clear the caches at the beginning of the next request (see LJ::handle_caches). There should be no need to ever call this function directly.
LJ::clear_hooks - Removes all hooks.
LJ::clear_rel - Deletes a relationship between two users or all relationships of a particular type for one user, on either side of the relationship. One of userid,targetid -- bit not both -- may be '*'. In that case, if, say, userid is '*', then all relationship edges with target equal to targetid and of the specified type are deleted. If both userid and targetid are numbers, just one edge is deleted.
LJ::clear_rel_multi - Clear relationship edges for lists of user tuples.
LJ::cmd_buffer_add - Schedules some command to be run sometime in the future which would be too slow to do syncronously with the web request. An example is deleting a journal entry, which requires recursing through a lot of tables and deleting all the appropriate stuff.
LJ::color_fromdb - Takes a value of unknown type from the db and returns an #rrggbb string.
LJ::color_todb - Takes an #rrggbb value and returns a 24-bit decimal number.
LJ::comm_join_request - Registers an authaction to add a user to a community and sends an approval email to the maintainers
LJ::create_account - Creates a new basic account. Note: This function is not really too useful but should be extended to be useful so htdocs/create.bml can use it, rather than doing the work itself.
LJ::create_qr_div - Creates the hidden div that stores the Quick Reply form
LJ::date_to_view_links - Returns HTML of date with links to user's journal.
LJ::days_in_month - Figures out the number of days in a month.
LJ::debug - When $LJ::DEBUG is set, logs the given message to the Apache error log. Or, if $LJ::DEBUG is 2, then prints to STDOUT.
LJ::decode_url_string - Parse URL-style arg/value pairs into a hash.
LJ::delete_all_comments - deletes all comments from a post, permanently, for when a post is deleted
LJ::delete_comments - deletes comments, but not the relational information, so threading doesn't break
LJ::delete_entry - Deletes a user's journal entry
LJ::delete_user -
LJ::did_post - When web pages using cookie authentication, you can't just trust that the remote user wants to do the action they're requesting. It's way too easy for people to force other people into making GET requests to a server. What if a user requested http://server/delete_all_journal.bml and that URL checked the remote user and immediately deleted the whole journal. Now anybody has to do is embed that address in an image tag and a lot of people's journals will be deleted without them knowing. Cookies should only show pages which make no action. When an action is being made, check that it's a POST request.
LJ::disconnect_dbs - Clear cached DB handles and trackers/keepers to partitioned DBs.
LJ::do_to_cluster - Given a subref, this function will pick a random cluster and run the subref,
LJ::durl - Decodes a value that's URL-escaped. See also LJ::eurl.
LJ::ehtml - Escapes a value before it can be put in HTML.
LJ::ejs - Escapes a string value before it can be put in JavaScript.
LJ::end_request - Clears cached DB handles/trackers/keepers (if $LJ::DISCONNECT_DBS is true) and disconnects MemCache handles (if $LJ::DISCONNECT_MEMCACHE is true).
LJ::etags - Escapes < and > from a string
LJ::eurl - Escapes a value before it can be put in a URL. See also LJ::durl.
LJ::event_register - Logs a subscribable event, if anybody's subscribed to it.
LJ::exml - Escapes a value before it can be put in XML.
LJ::expand_embedded -
LJ::expunge_userpic - Expunges a userpic so that the system will no longer deliver this userpic. If
LJ::fill_groups_xmlrpc - Fills a hashref (presumably to be sent to an XMLRPC client, EG fotobilder) with user friend group information
LJ::fill_var_props - S1 utility function to interpolate %%variables%% in a variable. If a modifier is given like %%foo:var%%, then LJ::fvp_transform is called.
LJ::flush_cleanup_handlers - Runs all cleanup handlers registered in @LJ::CLEANUP_HANDLERS
LJ::form_auth - Creates an authentication token to be used later to verify that a form
LJ::fvp_transform - Called from LJ::fill_var_props to do trasformations.
LJ::get_authas_list - Get a list of usernames a given user can authenticate as
LJ::get_authas_user - Given a username, will return a user object if remote is an admin for the username. Otherwise returns undef
LJ::get_bio - gets a user bio, from db or memcache
LJ::get_cap - Given a user object or capability class bit mask and a capability/limit name, returns the maximum value allowed for given user or class, considering all the limits in each class the user is a part of.
LJ::get_cap_min - Just like LJ::get_cap, but returns the minimum value. Although it might not make sense at first, some things are better when they're low, like the minimum amount of time a user might have to wait between getting updates or being allowed to refresh a page.
LJ::get_cluster_def_reader - Returns a definitive cluster reader for a given user, used when the caller wants the master handle, but will only use it to read.
LJ::get_cluster_description - Get descriptive text for a cluster id.
LJ::get_cluster_master - Returns a cluster master for a given user, used when the caller might use it to do a write (insert/delete/update/etc...)
LJ::get_cluster_reader - Returns a cluster slave for a user, or cluster master if no slaves exist.
LJ::get_community_row - Gets data relevant to a community such as their membership level and posting access.
LJ::get_dbh - Given one or more roles, returns a database handle.
LJ::get_dbirole_dbh - Internal function for get_dbh(). Uses the DBIRole to fetch a dbh, with hooks into db stats-generation if that's turned on.
LJ::get_friend_group - Returns friendgroup row(s) for a given user.
LJ::get_friend_items - Return friend items for a given user, filter, and period.
LJ::get_friendofs - Returns userids of friendofs for a given user.
LJ::get_friends - Returns friends rows for a given user.
LJ::get_keyword_id - Get the id for a keyword.
LJ::get_lastcomment - Looks up the last talkid and journal the remote user posted in
LJ::get_lock - get a mysql lock on a given key/dbrole combination
LJ::get_logtext2 - Efficiently retrieves a large number of journal entry text, trying first slave database servers for recent items, then the master in cases of old items the slaves have already disposed of. See also: LJ::get_talktext2.
LJ::get_logtext2multi - Gets log text from clusters.
LJ::get_mood_picture - Loads a mood icon hashref given a themeid and moodid.
LJ::get_newids - Lookup an old global ID and see what journal it belongs to and its new ID.
LJ::get_pending_invites - Gets a list of pending invitations for a user to join a community.
LJ::get_pending_members - Gets a list of userids for people that have requested to be added to a community
LJ::get_pic_from_keyword - Given a userid and keyword, returns the pic row hashref
LJ::get_posts_raw - Gets raw post data (text and props) efficiently from clusters.
LJ::get_prop - This is used to retrieve a hashref of a row from the given tablename's proplist table. One difference from getting it straight from the database is that the 'id' key is always present, as a copy of the real proplist unique id for that table.
LJ::get_recent_items - Returns journal entries for a given account.
LJ::get_reluser_id - for reluser2, numbers 1 - 31999 are reserved for livejournal stuff, whereas numbers 32000-65535 are used for local sites. if you wish to add your own hooks to this, you should define a hook "get_reluser_id" in no reluser2 types can be a single character, those are reserved for the reluser table so we don't have namespace problems.
LJ::get_remote - authenticates the user at the remote end based on their cookies and returns a hashref representing them
LJ::get_remote_noauth - returns who the remote user says they are, but doesn't check their login token. disadvantage: insecure, only use when you're not doing anything critical. advantage: faster.
LJ::get_sent_invites - Get a list of sent invitations from the past 30 days.
LJ::get_shared_journals - Gets an array of shared journals a user has access to.
LJ::get_talktext2 - Retrieves comment text. Tries slave servers first, then master.
LJ::get_timeupdate_multi - Get the last time a list of users updated
LJ::get_timezone - Gets the timezone offset for the user.
LJ::get_urls - Returns a list of all referenced URLs from a string
LJ::get_userid - Returns a userid given a username.
LJ::get_username - Returns a username given a userid.
LJ::get_userpic_info - Given a user gets their user picture info
LJ::handle_caches - clears caches if the CLEAR_CACHES flag is set from an earlier HUP signal that called LJ::clear_caches, otherwise does nothing.
LJ::hash_password -
LJ::help_icon - Returns BML to show a help link/icon given a help topic, or nothing if the site hasn't defined a URL for that topic. Optional arguments include HTML/BML to place before and after the link/icon, should it be returned.
LJ::http_to_time - Converts HTTP date to Unix time.
LJ::img - Returns an HTML <img> or <input> tag to an named image code, which each site may define with a different image file with its own dimensions. This prevents hard-coding filenames & sizes into the source. The real image data is stored in LJ::Img, which has default values provided in cgi-bin/ but can be overridden in cgi-bin/
LJ::infohistory_add - Add a line of text to the infohistory table for an account.
LJ::is_ascii - checks if text is pure ASCII
LJ::is_banned - Checks to see if a user is banned from a journal.
LJ::is_friend - Checks to see if a user is a friend of another user.
LJ::is_utf8 - check text for UTF-8 validity
LJ::is_valid_authaction - Validates a shared secret (authid/authcode pair)
LJ::item_link - Returns URL to view an individual journal item.
LJ::item_toutf8 - convert one item's subject, text and props to UTF8. item can be an entry or a comment (in which cases props can be left empty, since there are no 8bit talkprops).
LJ::join_community - Makes a user join a community. Takes care of all reluser and friend stuff.
LJ::journal_base - Returns URL of a user's journal.
LJ::leave_community - Makes a user leave a community. Takes care of all reluser and friend stuff.
LJ::ljuser - Make link to userinfo/journal of user.
LJ::load_codes - Populates hashrefs with lookup data from the database or from memory, if already loaded in the past. Examples of such lookup data include state codes, country codes, color name/value mappings, etc.
LJ::load_log_props2 -
LJ::load_log_props2multi -
LJ::load_mood_theme - Loads and caches a mood theme, or returns immediately if already loaded.
LJ::load_moods -
LJ::load_props - Loads and caches one or more of the various *proplist tables: logproplist, talkproplist, and userproplist, which describe the various meta-data that can be stored on log (journal) items, comments, and users, respectively.
LJ::load_rel_target - Load user relationship information. Loads all relationships of type 'type' in which user 'targetid' participates on the right side (is the target of the relationship).
LJ::load_rel_user - Load user relationship information. Loads all relationships of type 'type' in which user 'userid' participates on the left side (is the source of the relationship).
LJ::load_talk_props2 -
LJ::load_user - Loads a user record given a username.
LJ::load_user_privs -
LJ::load_user_props - Given a user hashref, loads the values of the given named properties into that user hashref.
LJ::load_userid - Loads a user record given a userid.
LJ::load_userids_multiple - Loads a number of users at once, efficiently.
LJ::load_userpics - Loads a bunch of userpic at once.
LJ::make_auth_code - Makes a random string of characters of a given length.
LJ::make_authas_select - Given a u object and some options, determines which users the given user can switch to. If the list exists, returns a select list and a submit button with labels. Otherwise returns a hidden element.
LJ::make_cookie - Prepares cookie header lines.
LJ::make_graphviz_dot_file -
LJ::make_journal -
LJ::make_link - Takes a group of key=value pairs to append to a url
LJ::make_qr_link - Creates the link to toggle the QR reply form or if
LJ::make_qr_target - Returns a div usable for Quick Reply boxes
LJ::make_remote - Returns a minimal user structure ($remote-like) from a username and userid.
LJ::make_user_active - Record user activity per cluster to make per-activity cluster stats easier.
LJ::mark_comment_as_spam - Copies a comment into the global spamreports table
LJ::mark_dirty - Marks a given user as being $what type of dirty
LJ::may_lock - see if we COULD get a mysql lock on a given key/dbrole combination, but don't actually get it.
LJ::memcache_kill - Kills a memcache entry, given a userid and type
LJ::modify_caps - Given a list of caps to add and caps to remove, updates a user's caps
LJ::mysql_time -
LJ::name_caps - Given a user's capability class bit mask, returns a site-specific string representing the capability class name.
LJ::name_caps_short - Given a user's capability class bit mask, returns a site-specific short string code.
LJ::new_account_cluster - Which cluster to put a new account on. $DEFAULT_CLUSTER if it's a scalar, random element from @$DEFAULT_CLUSTER if it's arrayref. also verifies that the database seems to be available.
LJ::parse_vars - Parses S1 style data into hashref.
LJ::prepare_currents - do all the current music/mood/weather/whatever stuff. only used by
LJ::procnotify_add - Sends a message to all other processes on all clusters.
LJ::procnotify_callback - Call back function process notifications.
LJ::record_anon_comment_ip - Records the IP address of an anonymous comment
LJ::record_meme - Records a URL reference from a journal entry to the meme table.
LJ::register_authaction - Registers a secret to have the user validate.
LJ::register_hook - Installs a site-specific hook.
LJ::register_setter - Installs code to run for the "set" command in the console.
LJ::reject_comm_invite - Rejects an invitation a user has received.
LJ::reject_pending_member - Rejects someone's request to join a community. Updates authactions and generates
LJ::release_lock - release a mysql lock on a given key/dbrole combination
LJ::remote_has_priv - Check to see if the given remote user has a certain priviledge
LJ::remove_friend -
LJ::robot_meta_tags - Returns meta tags to block a robot from indexing or following links
LJ::run_hook - Runs single site-specific hook of the given name.
LJ::run_hooks - Runs all the site-specific hooks of the given name.
LJ::send_comm_invite - Sends an invitation to a user to join a community with the passed abilities.
LJ::send_mail - Sends email. Character set will only be used if message is not ascii.
LJ::server_down_html - Returns an HTML server down message.
LJ::set_interests - Change a user's interests
LJ::set_lastcomment - Sets the lastcomm Memcache key for this user's last comment
LJ::set_rel - Sets relationship information for two users.
LJ::set_rel_multi - Sets relationship edges for lists of user tuples.
LJ::set_userprop - Sets/deletes a userprop by name for a user.
LJ::shared_member_request - Registers an authaction to add a user to a shared journal and sends an approval email
LJ::start_request - Before a new web request is obtained, this should be called to determine if process should die or keep working, clean caches, reload config files, etc.
LJ::statushistory_add - Adds a row to a user's statushistory
LJ::strip_bad_code - Removes malicious/annoying HTML.
LJ::sysban_block - Notes a sysban in statushistory and returns a fake http error message to the user
LJ::sysban_check - Given a 'what' and 'value', checks to see if a ban exists
LJ::sysban_note - Inserts a properly-formatted row into statushistory noting that a ban has been triggered
LJ::text_compress - Compresses a chunk of text, to gzip, if configured for site. Can compress a scalarref in place, or return a compressed copy. Won't compress if value is too small, already compressed, or size would grow by compressing.
LJ::text_convert - convert old entries/comments to UTF-8 using user's default encoding
LJ::text_in - do appropriate checks on input text. Should be called on all user-generated text.
LJ::text_length - returns both byte length and character length of a string. In a non-Unicode environment, this means byte length twice. In a Unicode environment, the function assumes that its argument is a valid UTF-8 string.
LJ::text_out - force outgoing text into valid UTF-8
LJ::text_trim - truncate string according to requirements on byte length, char length, or both. "char length" means number of UTF-8 characters if $LJ::UNICODE is set, or the same thing as byte length otherwise.
LJ::text_uncompress - Uncompresses a chunk of text, from gzip, if configured for site. Can uncompress a scalarref in place, or return a compressed copy. Won't uncompress unless it finds the gzip magic number at the beginning of the text.
LJ::time_to_cookie - Converts unix time to format expected in a Set-Cookie header
LJ::time_to_http - Converts a Unix time to an HTTP date.
LJ::trim - Removes whitespace from left and right side of a string.
LJ::u_equals - Compares two user objects to see if they're the same user.
LJ::use_diff_db -
LJ::want_user - Returns user object when passed either userid or the user hash. Useful to functions that want to accept either.
LJ::want_userid - Returns userid when passed either userid or the user hash. Useful to functions that want to accept either. Forces its return value to be a number (for safety).
VI. Database Schema
15. Relationships between users
IV. Database Schema Browser
Updating cluster: 0 -
abuse_mail -
acctcode - Keeps track of valid invite codes and who has used them. To see why they were made, see table acctinvite.
acctinvite - Keeps track of generated invite codes.
acctpay - Keeps track of relationship between invite codes and payments. Some people pay to join the site before they have an account, so their invite code carries with it the knowledge that it comes with paid time.
acctpayitem -
adopt - unused. designed for the "Adopt-a-newbie" system, but never fully implemented.
adoptlast - unused. designed for the "Adopt-a-newbie" system, but never fully implemented.
authactions - When authenticating certain actions, the server generates an authaction along with some random characters (the authcode) and emails the aaid+authcode to the user to confirm they actually got it.
authnetlog -
blobcache -
bzrbalance -
bzrpayout -
bzrpot -
bzrs -
bzrvote -
bzrvoter -
captcha_session -
captchas -
ccfail -
challenges -
clients - Keeps track of clients that access the protocol. Whenever the protocol encounters a new client, a new row (and thus a new clientid) is generated.
clientusage - Keeps track of when different users use which clients, for purposes of statistics.
clustermove -
clustermove_inprogress -
clustertrack2 -
cmdbuffer - Clustered version of querybuffer. Uses specialized commands instead of general table locking
codes - Lookup table for states, countries, languages, etc...
comminterests -
community - Keeps track of properties of community accounts (which are just normal user accounts with some extra behavior)
contributed -
contributedack -
counter -
coupon -
dbinfo - For LiveJournal installations with many databases, the database connection info, roles, and weightings can be stored in the database instead of the %LJ::DBINFO hash, for easier (web-based) management.
dbweights - The dbinfo table keeps track of which databases exist. This ones keeps track of each database's roles and weights.
dirsearchres2 - Holds the results of a directory search query. userids is either "[searching]" if a query is still running, or a list of userids if it is finished.
domains - Keeps track of user-owned domain names, and which journals they map to when pointed at the LiveJournal installation's IP address.
dudata - Tracks user-based disk usage totals.
duplock - Provides a place to record that an action has been done, so it doesn't get done a second time later by a user accidentally double-clicking a single-click button in their browser. The idea is that the application should grab a write lock for both the table it's inserting into, and the duplock table. Then, check the duplock table for a duplicate. If it's already in there, unlock the tables and remember the dupid to tell the user (app should pretend it was the first time... don't show an error message!), or if it's not in there, put it in the table, and then put the resulting uniqueid from the table handler into the duplock table (as dupid). The duplock table is purged every hour or so of all locks older than an hour.
email_aliases -
events - Unused as of this writing. Part of the "subscription" system.
faq - Holds Frequently Asked Question information for the FAQ section of the support system. Alternate text can be loaded for the questions if available.
faqcat - Categories that frequently asked questions can be classified under
faquses - Tracks viewings of the individual faqs from logged-in users.
fotobilder_feedback -
friendgroup - Table describing a user's friends groups. Friends groups are used to restrict who can see an individual post, or to filter the friends view.
friendgroup2 -
friends - Table describing users someone has listed as a "friend". Also details preferences on the friend item.
includetext - Database table for storing special "include" files used in sections of the site (like the "known issues" box in support). Useful for keeping clusters of web servers in sync easier.
infohistory - A history log table for certain types of changes (like user e-mail changes). So the old values can be looked at by administrators or automatically retrieved.
interests - Table describing the different interests listed, and the number of users listing each interest.
inventory -
inviterecv -
invitesent -
keywords -
links -
log2 -
loginstall -
logprop2 -
logproplist - List of possible meta-data for journal entries.
logsec2 -
logtext2 -
meetup_ints -
meme -
memkeyword -
memkeyword2 -
memorable -
memorable2 -
ml_domains -
ml_items -
ml_langdomains -
ml_langs -
ml_latest -
ml_text -
modblob -
modlog -
moods -
moodthemedata -
moodthemes -
news_sent -
noderefs -
oldids -
openproxy -
overrides -
paidexp -
paiduser -
partialstats -
partialstatsdata -
paycredit -
payitems -
payments -
paymentsearch -
paystates -
payvars -
phonepostentry -
phonepostlogin -
phoneposttrans -
poll -
pollitem -
pollquestion -
pollresult -
pollsubmission -
portal -
priv_list - List of different admin privileges that users can have.
priv_map -
procnotify -
randomuserset -
rateabuse -
ratelist -
ratelog -
reluser -
reluser2 -
renames -
s1overrides -
s1style -
s1stylecache -
s1stylemap -
s1usercache -
s2checker -
s2compiled -
s2info -
s2layers -
s2source -
s2stylelayers -
s2styles -
schemacols -
schematables - This table is the documentation for the database tables.
secrets -
sessions -
sessions_data -
shipping -
spamreports -
stats -
statushistory -
style -
subs -
support -
supportcat - Categories for support system
supportlog -
supportnotify -
supportpoints -
supportpointsum -
supportprop -
survey_v0_8bit -
syndicated -
synitem -
sysban -
talk2 -
talkleft -
talkleft_xfp -
talkprop2 -
talkproplist - List of possible meta-data for comments.
talktext2 -
tempanonips -
themedata - Lists the system colors themes available to users.
themelist - Different color schemes. Hopefully this will die when the new style system replaces the current one.
todo -
tododep -
todokeyword -
transferinfo -
tshirtpoll -
txtmsg -
user -
userbio -
userblob -
useridmap -
userinterests -
userkeywords -
userpic -
userpic2 -
userpicblob2 -
userpicmap -
userpicmap2 -
userprop -
userpropblob -
userproplist - List of possible meta-data on users.
userproplite -
userproplite2 -
userupdate -
userusage - Keep track of when users did certain things.
weekuserusage -
zip - ZIP Code table used to validate and auto-complete data that users enter about their location. More information can be found in the redudant table zips, which was imported later.
zips - ZIP Code data for the United States that includes geographic coordinates. Only used with a ljmaint script that generates marker files for use in making xplanet maps. Most the LJ code uses the zip table instead.