Habari\Comment::remove_status PHP Метод

remove_status() публичный статический Метод

Remove a comment type from the database
public static remove_status ( integer | string $status, null | integer | string $newstatus = null )
$status integer | string The type of the comment
$newstatus null | integer | string If provided, the new status to change all of the comments with the deleted status to
    public static function remove_status($status, $newstatus = null)
    {
        // Delete comments of this status, delete status
        $status_id = Comment::status($status);
        if (is_null($newstatus)) {
            DB::delete(DB::table('comments'), array('status' => $status_id));
            DB::exec('DELETE FROM {commentinfo} WHERE comment_id IN (SELECT {commentinfo}.comment_id FROM {commentinfo} LEFT JOIN {comments} ON {commentinfo}.comment_id = {comments}.id WHERE {comments}.id IS NULL)');
        } else {
            DB::update(DB::table('comments'), array('status' => Comment::status($newstatus)), array('status' => $status_id));
        }
        DB::delete(DB::table('commentstatus'), array('name' => Comment::status_name($status)));
    }