Add option to speed up joining when not needed
This commit is contained in:
parent
73f9aaebe6
commit
4474be0df7
@ -37,4 +37,5 @@
|
||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC3', 'The list of available custom fields can be changed in the <a href="%s" target="_blank" title="' . PLUGIN_EVENT_ENTRYPROPERTIES_TITLE . '">plugin configuration</a>.');
|
||||
|
||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP', 'Disable Markup plugins for this entry:');
|
||||
?>
|
||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_EXTJOINS', 'Use extended database lookups');
|
||||
@define('PLUGIN_EVENT_ENTRYPROPERTIES_EXTJOINS_DESC', 'If enabled, additional SQL queries will be issued to be able to use sticky entries, hidden entries and removed entries from the frontpage. If those are not needed, disabling this feature can improve performance.');
|
||||
|
@ -26,7 +26,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'Garvin Hicking');
|
||||
$propbag->add('version', '1.15');
|
||||
$propbag->add('version', '1.16');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'smarty' => '2.6.7',
|
||||
@ -53,7 +53,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
'frontend_configure' => true
|
||||
));
|
||||
$propbag->add('groups', array('BACKEND_EDITOR'));
|
||||
$propbag->add('configuration', array('cache', 'use_groups', 'use_users', 'default_read', 'customfields'));
|
||||
$propbag->add('configuration', array('cache', 'use_groups', 'use_users', 'use_ext_joins', 'default_read', 'customfields'));
|
||||
}
|
||||
|
||||
function introspect_config_item($name, &$propbag)
|
||||
@ -86,6 +86,13 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'use_ext_joins':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_EVENT_ENTRYPROPERTIES_EXTJOINS);
|
||||
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_EXTJOINS_DESC);
|
||||
$propbag->add('default', 'true');
|
||||
break;
|
||||
|
||||
case 'use_users':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_EVENT_ENTRYPROPERTIES_USERS);
|
||||
@ -234,11 +241,19 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null) {
|
||||
global $serendipity;
|
||||
static $is_cache = null;
|
||||
static $use_groups = null;
|
||||
static $use_users = null;
|
||||
static $ext_joins = null;
|
||||
|
||||
$hooks = &$bag->get('event_hooks');
|
||||
$is_cache = serendipity_db_bool($this->get_config('cache', 'true'));
|
||||
$use_groups = serendipity_db_bool($this->get_config('use_groups'));
|
||||
$use_users = serendipity_db_bool($this->get_config('use_users'));
|
||||
|
||||
if ($is_cache === null) {
|
||||
$is_cache = serendipity_db_bool($this->get_config('cache', 'true'));
|
||||
$use_groups = serendipity_db_bool($this->get_config('use_groups'));
|
||||
$use_users = serendipity_db_bool($this->get_config('use_users'));
|
||||
$ext_joins = serendipity_db_bool($this->get_config('use_ext_joins'));
|
||||
}
|
||||
|
||||
if (isset($hooks[$event])) {
|
||||
switch($event) {
|
||||
@ -665,6 +680,9 @@ class serendipity_event_entryproperties extends serendipity_event
|
||||
case 'frontend_fetchentry':
|
||||
$joins = array();
|
||||
$conds = array();
|
||||
if (!$ext_joins) {
|
||||
return true;
|
||||
}
|
||||
if ($_SESSION['serendipityAuthedUser'] === true) {
|
||||
$conds[] = " (ep_access.property IS NULL OR ep_access.value = 'member' OR ep_access.value = 'public' OR (ep_access.value = 'private' AND e.authorid = " . (int)$serendipity['authorid'] . ")) ";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user