mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-29 06:38:52 +00:00
[feature/soft-delete] Allow forcing the set_visibility for all posts
PHPBB3-9567
This commit is contained in:
parent
42bb97a95c
commit
92c5039af9
1 changed files with 15 additions and 12 deletions
|
@ -139,7 +139,7 @@ class phpbb_content_visibility
|
||||||
* @param $forum_id - int - forum ID where $topic_id resides
|
* @param $forum_id - int - forum ID where $topic_id resides
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason)
|
static public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
@ -148,17 +148,20 @@ class phpbb_content_visibility
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT topic_visibility, topic_delete_time
|
if (!$force_update_all && $visibility == ITEM_APPROVED)
|
||||||
FROM ' . TOPICS_TABLE . '
|
|
||||||
WHERE topic_id = ' . (int) $topic_id;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$original_topic_data = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if (!$original_topic_data)
|
|
||||||
{
|
{
|
||||||
// The topic does not exist...
|
$sql = 'SELECT topic_visibility, topic_delete_time
|
||||||
return;
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE topic_id = ' . (int) $topic_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$original_topic_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!$original_topic_data)
|
||||||
|
{
|
||||||
|
// The topic does not exist...
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
|
@ -174,7 +177,7 @@ class phpbb_content_visibility
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
// If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion.
|
// If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion.
|
||||||
if ($original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED)
|
if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED)
|
||||||
{
|
{
|
||||||
// Note, we do not set the same reason for every post.
|
// Note, we do not set the same reason for every post.
|
||||||
self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']);
|
self::set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']);
|
||||||
|
|
Loading…
Add table
Reference in a new issue