[buddypress-trac] [BuddyPress Trac] #5385: Add default options at installation/upgrade to 2.0
buddypress-trac
noreply at wordpress.org
Sat Feb 8 19:02:21 UTC 2014
#5385: Add default options at installation/upgrade to 2.0
--------------------------+-----------------
Reporter: boonebgorges | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0
Component: Core | Version:
Severity: normal | Keywords:
--------------------------+-----------------
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?
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5385>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list