#4584 - Script to delete old empty comment topics

  • By
  • Added
  • 1 view
Identifier #4584
Issue type Feature request or suggestion
Title Script to delete old empty comment topics
Status Open
Handling member Deleted
Addon core_cns
Description If someone decides to disable the previously-enabled strong_forum_tie option, they will be left over with lots of empty comment topics.
Make a Commandr command to clean this up.
Steps to reproduce

Basic query would be like this.

set_option('is_on_strong_forum_tie', '0');

$db = $GLOBALS['FORUM_DB'];

$db->query('DELETE FROM ' . $db->get_table_prefix() . 'f_topics WHERE t_cache_num_posts=1 AND t_description LIKE \'Comment: %\'');

$db->query('DELETE FROM ' . $db->get_table_prefix() . 'f_posts p WHERE NOT EXISTS (SELECT * FROM cms_f_topics t WHERE t.id=p.p_topic_id)');

require_lang('cns');

require_code('tasks');

call_user_func_array__long_task(do_lang('CACHE_FORUMS'), null, 'cns_recache');

Should not assume 'Comment' though, needs to check language string.

Also should not assume multi-lang-content is disabled, there will be language strings to cleanup.

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated