• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed [Speed Up] No need to rebuild moderation queue if no rows affected

guiltar

Well-known member
#1
Hello!

There is a method.
PHP:
    public function deleteFromModerationQueue($contentType, $contentIds)
    {
       ....

        $db = $this->_getDb();
        $db->delete('xf_moderation_queue',
            'content_type = ' . $db->quote($contentType) . ' AND content_id IN (' . $db->quote($contentIds) . ')'
        );

        $this->rebuildModerationQueueCountCache();
    }
I suggest not to rebuild moderation queue if no rows affected. It causes db locks if the content is being deleted often. Suggestion:
PHP:
    public function deleteFromModerationQueue($contentType, $contentIds)
    {
       ....
        $db = $this->_getDb();
        $affectedRows = $db->delete('xf_moderation_queue',
            'content_type = ' . $db->quote($contentType) . ' AND content_id IN (' . $db->quote($contentIds) . ')'
        );
        if($affectedRows)
             $this->rebuildModerationQueueCountCache();
    }