public function deleteAutomaticBlacklist($onlyExpired = true)
    {
        $sql = 'DELETE FROM LoginControlIpRanges WHERE lcirType = ' . (int) static::IPRANGETYPE_BLACKLIST_AUTOMATIC;
        if ($onlyExpired) {
            $platform = $this->connection->getDatabasePlatform();
            $sql .= ' AND lcirExpires <= ' . $platform->getNowExpression();
        }

        return (int) $this->connection->executeQuery($sql)->rowCount();
    }