Opened 11 years ago
Closed 11 years ago
#5385 closed enhancement (fixed)
Add default options at installation/upgrade to 2.0
Reported by: | boonebgorges | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: |
Description
BP loads many options during its bootstrap. Some are done in a single query (bp_core_get_root_options()), while others are checked along the way. Options that exist in the database, and are set to autoload, are fetched by WordPress the first time that wp_load_alloptions() is called; this ensures that future calls to get_option()
will hit the cache instead of resulting in another DB query. However, for those options that are *not* found in the database, a separate (and, of course, unsuccessful) DB query is made. (This only happens when not using a persistent cache; otherwise these misses are stored in 'notoptions'.)
For this reason, I suggest that we install all of our default options in the DB at installation. That way, we can avoid all the unnecessary queries for stuff like 'bp-blogs-first-install'. In my tests, this can cut 10-15 queries per pageload off of a fresh installation of BuddyPress. (Keep the "fresh" point in mind. If you have an old development installation, it's likely that most settings are saved in your database.)
We already have a function bp_add_option()
that must've been ported from bbPress but is unused. The attached patch updates the list of default options, and fires bp_add_option()
at installation/upgrade. Any reasons not to do this?
In 7904: