aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/content_visibility.php
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2014-06-20 13:25:45 +0530
committerDhruv <dhruv.goel92@gmail.com>2014-06-20 13:25:45 +0530
commit1a79de4214ac459e7e341e4f4c25061936e22c1f (patch)
tree43cf3ad6498271d9efef8a2c19a9e4cee29dbe68 /phpBB/phpbb/content_visibility.php
parent517273fa0bf77f40f51029e818bb36e15e7c6671 (diff)
downloadforums-1a79de4214ac459e7e341e4f4c25061936e22c1f.tar
forums-1a79de4214ac459e7e341e4f4c25061936e22c1f.tar.gz
forums-1a79de4214ac459e7e341e4f4c25061936e22c1f.tar.bz2
forums-1a79de4214ac459e7e341e4f4c25061936e22c1f.tar.xz
forums-1a79de4214ac459e7e341e4f4c25061936e22c1f.zip
[ticket/12738] Inject config object into content_visibility class
PHPBB3-12738
Diffstat (limited to 'phpBB/phpbb/content_visibility.php')
-rw-r--r--phpBB/phpbb/content_visibility.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 0c64b5b7a7..410dc77c3d 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -38,6 +38,12 @@ class content_visibility
protected $auth;
/**
+ * config object
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
* phpBB root path
* @var string
*/
@@ -62,9 +68,10 @@ class content_visibility
* @param string $topics_table Topics table name
* @param string $users_table Users table name
*/
- public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
+ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
{
$this->auth = $auth;
+ $this->config = $config;
$this->db = $db;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
@@ -576,7 +583,7 @@ class content_visibility
$sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1';
}
- set_config_count('num_posts', 1, true);
+ $this->config->increment('num_posts', 1, false);
}
/**
@@ -598,7 +605,7 @@ class content_visibility
$sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
}
- set_config_count('num_posts', -1, true);
+ $this->config->increment('num_posts', -1, false);
}
else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
{
@@ -640,8 +647,8 @@ class content_visibility
$sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
$sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];
- set_config_count('num_topics', -1, true);
- set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true);
+ $this->config->increment('num_topics', -1, false);
+ $this->config->increment('num_posts', $topic_row['topic_posts_approved'] * (-1), false);
// Get user post count information
$sql = 'SELECT poster_id, COUNT(post_id) AS num_posts