Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11445

Suboptimal number of query complexity in phpbb_notification_manager::get_global_subscriptions()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.0-RC1
    • 3.1.0-dev
    • Notification System
    • None

      Query in a two-dimensional loop. This already accounts for 1/2 of the queries on https://area51.phpbb.com/phpBB/ucp.php?i=ucp_notifications&mode=notification_options and scales poorly when new notification methods or types are added.

      		foreach ($this->get_subscription_types() as $group_name => $types)
      		{
      			foreach ($types as $id => $type)
      			{
      				$sql = 'SELECT method, notify
      					FROM ' . $this->user_notifications_table . '
      					WHERE user_id = ' . (int) $user_id . "
      						AND item_type = '" . $this->db->sql_escape($id) . "'
      						AND item_id = 0";
      				$result = $this->db->sql_query($sql);
      

            dhruv.goel92 Dhruv Goel [X] (Inactive)
            bantu Andreas Fischer [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: