diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2012-05-14 23:41:31 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2012-05-14 23:41:31 -0700 |
commit | 40d35166d3f2211ab76943834a983330413ab761 (patch) | |
tree | 14a505037c0d25ea931b97cdac8668b8fa5d3403 /engine/lib | |
parent | 11e83f1864a17a98c794dd598731a5129aa8a8e7 (diff) | |
download | elgg-40d35166d3f2211ab76943834a983330413ab761.tar.gz elgg-40d35166d3f2211ab76943834a983330413ab761.tar.bz2 |
Refs #4313. Loading ElggPlugin classes with the fully joined objects table.
This cuts the number of db queries in half for loading plugins with elgg_get_plugins().
Will look to adapt these techniques to other classes in 1.8.6.
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/plugins.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 123fb18d8..39a76db5d 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -93,10 +93,13 @@ function elgg_get_plugin_ids_in_dir($dir = null) { function elgg_generate_plugin_entities() { $site = get_config('site'); $dir = elgg_get_plugins_path(); + $db_prefix = elgg_get_config('dbprefix'); $options = array( 'type' => 'object', 'subtype' => 'plugin', + 'selects' => array('plugin_oe.*'), + 'joins' => array("JOIN {$db_prefix}objects_entity plugin_oe on plugin_oe.guid = e.guid"), 'limit' => ELGG_ENTITIES_NO_VALUE ); @@ -352,7 +355,11 @@ function elgg_get_plugins($status = 'active', $site_guid = null) { 'type' => 'object', 'subtype' => 'plugin', 'limit' => ELGG_ENTITIES_NO_VALUE, - 'joins' => array("JOIN {$db_prefix}private_settings ps on ps.entity_guid = e.guid"), + 'selects' => array('plugin_oe.*'), + 'joins' => array( + "JOIN {$db_prefix}private_settings ps on ps.entity_guid = e.guid", + "JOIN {$db_prefix}objects_entity plugin_oe on plugin_oe.guid = e.guid" + ), 'wheres' => array("ps.name = '$priority'"), 'order_by' => "CAST(ps.value as unsigned), e.guid" ); |