diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 19:30:33 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 19:30:33 +0200 |
| commit | 44ed05f5678b36d907555ed040229564b336632f (patch) | |
| tree | dfa5dac6820c6374a8f95dbc8c2950bf8a3620f2 /phpBB | |
| parent | 36c9f6aa87f48744623ea49fe7151e41c0186d05 (diff) | |
| download | forums-44ed05f5678b36d907555ed040229564b336632f.tar forums-44ed05f5678b36d907555ed040229564b336632f.tar.gz forums-44ed05f5678b36d907555ed040229564b336632f.tar.bz2 forums-44ed05f5678b36d907555ed040229564b336632f.tar.xz forums-44ed05f5678b36d907555ed040229564b336632f.zip | |
[feature/soft-delete] Simplify the query output if the user has m_restore
PHPBB3-9657
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/content_visibility.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index 12b51df3bb..5c3e9d39dd 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -42,6 +42,11 @@ class phpbb_content_visibility if ($auth->acl_get('m_restore', $forum_id)) { $status_ary[] = ITEM_DELETED; + + // If the user has m_restore, the rest of the function will not + // make more content visible, so we can return the query here. + // This avoids one OR in all queries + return $db->sql_in_set($table_alias . $mode . '_visibility', $status_ary); } $clause = $db->sql_in_set($table_alias . $mode . '_visibility', $status_ary); @@ -52,8 +57,7 @@ class phpbb_content_visibility $poster_column = ($mode == 'topic') ? 'topic_poster' : 'poster_id'; $clause = '(' . $clause . " OR ($table_alias{$mode}_visibility = " . ITEM_DELETED . " - AND $table_alias$poster_column = " . $user->data['user_id'] . '))'; - + AND $table_alias$poster_column = " . (int) $user->data['user_id'] . '))'; } return $clause; |
