论坛软件应该在审核后删除主题/帖子还是干脆隐藏? [英] Should forum software literally DELETE topics/posts upon moderation or simply hide?

查看:68
本文介绍了论坛软件应该在审核后删除主题/帖子还是干脆隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想看看你的意见,因为我正在开发一个与共存的 CMS 一起的论坛脚本 - 我对 ACL 等进行了排序.

Just curious to see your opinions, as I am developing a forum script alongside a coexisting CMS - which i have the ACL etc. sorted.

但是想知道是否最好执行 DELETE FROM...(如删除记录)...或者只是执行 UPDATE 来设置列to 1 (bool) - 隐藏它(所以它看起来被删除了).

But was wondering if it is best to do DELETE FROM... (as in delete the record)...or just do an UPDATE to set a column to 1 (bool) - which hides it (so it looks deleted).

PS:只有我信任的人才能使用审核工具

PS: only those who I trust have access to moderation tools

推荐答案

这取决于您,通常是您要删除的数据的重要性,或者您希望对意外事件的容忍度.

That's up to you and usually a question of how important is the data you are deleting, or how tolerant you want to be with accidents.

我喜欢使用的方法是为要删除的项目创建一个克隆数据库.删除时,将所选行的内容复制到新数据库,然后删除.系统中多余的已删除"文章或项目只会占用更多空间,最终会降低查询速度(可能).

The method I like to use is have a clone database for items you wish to delete. On delete, copy the contents of the selected row to new database, then delete. Having extra "deleted" articles or items in your system is just using up more space and eventually will slow down queries (potentially).

填满删除文章"数据库后,运行转储、存档、截断.

Once you fill up your "delete articles" database, run a dump, archive, truncate.

假设您有一个数据库 CMS,其中有一个名为 ARTICLES 的表,您要存储已删除的帖子,我们将创建一个具有相同表结构的相同数据库:

Let's say you have the database CMS with a table called ARTICLES that you want to store deleted posts, we will create an identical database with the same table structure:

CREATE DATABASE `deleted`;
CREATE TABLE deleted.cmsarticles LIKE CMS.ARTICLES;

在删除内容的 PHP 脚本中,您将执行以下操作:

In your PHP script that's deleting the content you would do something like this:

//GRAB THE ID OF THE ARTICLE YOU ARE DELETING, MAKE SURE TO SANITIZE!
$article_id=$_POST['id'];
if(is_numeric($article_id) {
    $dbconnect=databaseFunction();
    $result=$dbconnect->query("SELECT `row1`,`row2` FROM `ARTICLES` WHERE `id`=$article_id");
    if($result->num_rows!=0) {
        $row=$result->fetch_array(MYSQLI_ASSOC);
        //Open new connection to deleted database
        $dbconnect2=otherDBFunction();
        $dbconnect2->query("INSERT INTO `cmsarticles`(row1,row2) VALUES ({$row['row1']},{$row['row2']}");
        $dbconnect->query("DELETE FROM `ARTICLES` where `id`={$_POST['id']}");
    }
}

这篇关于论坛软件应该在审核后删除主题/帖子还是干脆隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆