mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 08:35:31 +02:00
[ticket/11103] Change is_disabled to is_enabled
If you're following along and would like to update your DB, you can run the following queries to do so: ALTER TABLE phpbb_notifications CHANGE `is_disabled` `is_enabled` TINYINT( 1 ) NOT NULL DEFAULT '1'; UPDATE `phpbb_notifications` SET is_enabled = 1; PHPBB3-11103
This commit is contained in:
parent
c7c3ab07c6
commit
471ca5e7dc
@ -1303,7 +1303,7 @@ function get_schema_struct()
|
|||||||
'item_parent_id' => array('UINT', 0),
|
'item_parent_id' => array('UINT', 0),
|
||||||
'user_id' => array('UINT', 0),
|
'user_id' => array('UINT', 0),
|
||||||
'unread' => array('BOOL', 1),
|
'unread' => array('BOOL', 1),
|
||||||
'is_disabled' => array('BOOL', 0),
|
'is_enabled' => array('BOOL', 0),
|
||||||
'time' => array('TIMESTAMP', 1),
|
'time' => array('TIMESTAMP', 1),
|
||||||
'data' => array('TEXT_UNI', ''),
|
'data' => array('TEXT_UNI', ''),
|
||||||
),
|
),
|
||||||
@ -1315,7 +1315,7 @@ function get_schema_struct()
|
|||||||
'user_id' => array('INDEX', 'user_id'),
|
'user_id' => array('INDEX', 'user_id'),
|
||||||
'time' => array('INDEX', 'time'),
|
'time' => array('INDEX', 'time'),
|
||||||
'unread' => array('INDEX', 'unread'),
|
'unread' => array('INDEX', 'unread'),
|
||||||
'is_disabled' => array('INDEX', 'is_disabled'),
|
'is_enabled' => array('INDEX', 'is_enabled'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class phpbb_notification_manager
|
|||||||
FROM ' . NOTIFICATIONS_TABLE . '
|
FROM ' . NOTIFICATIONS_TABLE . '
|
||||||
WHERE user_id = ' . (int) $options['user_id'] . '
|
WHERE user_id = ' . (int) $options['user_id'] . '
|
||||||
AND unread = 1
|
AND unread = 1
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$unread_count = (int) $this->db->sql_fetchfield('count', $result);
|
$unread_count = (int) $this->db->sql_fetchfield('count', $result);
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@ -132,7 +132,7 @@ class phpbb_notification_manager
|
|||||||
$sql = 'SELECT COUNT(*) AS count
|
$sql = 'SELECT COUNT(*) AS count
|
||||||
FROM ' . NOTIFICATIONS_TABLE . '
|
FROM ' . NOTIFICATIONS_TABLE . '
|
||||||
WHERE user_id = ' . (int) $options['user_id'] . '
|
WHERE user_id = ' . (int) $options['user_id'] . '
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$total_count = (int) $this->db->sql_fetchfield('count', $result);
|
$total_count = (int) $this->db->sql_fetchfield('count', $result);
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@ -145,7 +145,7 @@ class phpbb_notification_manager
|
|||||||
FROM ' . NOTIFICATIONS_TABLE . '
|
FROM ' . NOTIFICATIONS_TABLE . '
|
||||||
WHERE user_id = ' . (int) $options['user_id'] .
|
WHERE user_id = ' . (int) $options['user_id'] .
|
||||||
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . '
|
(($options['notification_id']) ? ((is_array($options['notification_id'])) ? ' AND ' . $this->db->sql_in_set('notification_id', $options['notification_id']) : ' AND notification_id = ' . (int) $options['notification_id']) : '') . '
|
||||||
AND is_disabled = 0
|
AND is_enabled = 1
|
||||||
ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
||||||
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ class phpbb_notification_manager
|
|||||||
WHERE user_id = ' . (int) $options['user_id'] . '
|
WHERE user_id = ' . (int) $options['user_id'] . '
|
||||||
AND unread = 1
|
AND unread = 1
|
||||||
AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . '
|
AND ' . $this->db->sql_in_set('notification_id', array_keys($rowset), true) . '
|
||||||
AND is_disabled = 0
|
AND is_is_enabled = 1
|
||||||
ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
ORDER BY ' . $this->db->sql_escape($options['order_by']) . ' ' . $this->db->sql_escape($options['order_dir']);
|
||||||
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
$result = $this->db->sql_query_limit($sql, $options['limit'], $options['start']);
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ class phpbb_notification_manager
|
|||||||
FROM ' . NOTIFICATIONS_TABLE . "
|
FROM ' . NOTIFICATIONS_TABLE . "
|
||||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||||
AND item_id = " . (int) $item_id . '
|
AND item_id = " . (int) $item_id . '
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -68,14 +68,14 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indentification data
|
* Indentification data
|
||||||
* item_type
|
* item_type - Type of the item (translates to the notification type)
|
||||||
* item_id
|
* item_id - ID of the item (e.g. post_id, msg_id)
|
||||||
* item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc)
|
* item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc)
|
||||||
* user_id
|
* user_id
|
||||||
* unread
|
* unread
|
||||||
* is_disabled - EXTENSION AUTHORS TAKE NOTE! This is to prevent errors with notifications from extensions!
|
* is_enabled - EXTENSION AUTHORS TAKE NOTE! This is to prevent errors with notifications from extensions!
|
||||||
* - Set is_disabled to 1 for all your notifications when your extension is disabled so they are ignored and do not cause errors.
|
* - Set is_enabled to 0 for all your notifications when your extension is disabled so they are ignored and do not cause errors.
|
||||||
* - When your extension is enabled again, set is_disabled to 0 and your notifications will be working again.
|
* - When your extension is enabled again, set is_enabled to 1 and your notifications will be working again.
|
||||||
*
|
*
|
||||||
* time
|
* time
|
||||||
* data (special serialized field that each notification type can use to store stuff)
|
* data (special serialized field that each notification type can use to store stuff)
|
||||||
|
@ -114,7 +114,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
|
|||||||
WHERE item_type = '" . self::get_item_type() . "'
|
WHERE item_type = '" . self::get_item_type() . "'
|
||||||
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||||
AND unread = 1
|
AND unread = 1
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
|
|||||||
WHERE item_type = '" . self::get_item_type() . "'
|
WHERE item_type = '" . self::get_item_type() . "'
|
||||||
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||||
AND unread = 1
|
AND unread = 1
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -133,7 +133,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
|||||||
WHERE item_type = '" . self::get_item_type() . "'
|
WHERE item_type = '" . self::get_item_type() . "'
|
||||||
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
AND item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||||
AND unread = 1
|
AND unread = 1
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
|||||||
FROM ' . NOTIFICATIONS_TABLE . "
|
FROM ' . NOTIFICATIONS_TABLE . "
|
||||||
WHERE item_type = '" . self::get_item_type() . "'
|
WHERE item_type = '" . self::get_item_type() . "'
|
||||||
AND item_id = " . self::get_item_id($post) . '
|
AND item_id = " . self::get_item_id($post) . '
|
||||||
AND is_disabled = 0';
|
AND is_enabled = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -1133,7 +1133,7 @@ function database_update_info()
|
|||||||
'item_parent_id' => array('UINT', 0),
|
'item_parent_id' => array('UINT', 0),
|
||||||
'user_id' => array('UINT', 0),
|
'user_id' => array('UINT', 0),
|
||||||
'unread' => array('BOOL', 1),
|
'unread' => array('BOOL', 1),
|
||||||
'is_disabled' => array('BOOL', 0),
|
'is_enabled' => array('BOOL', 0),
|
||||||
'time' => array('TIMESTAMP', 1),
|
'time' => array('TIMESTAMP', 1),
|
||||||
'data' => array('TEXT_UNI', ''),
|
'data' => array('TEXT_UNI', ''),
|
||||||
),
|
),
|
||||||
@ -1145,7 +1145,7 @@ function database_update_info()
|
|||||||
'user_id' => array('INDEX', 'user_id'),
|
'user_id' => array('INDEX', 'user_id'),
|
||||||
'time' => array('INDEX', 'time'),
|
'time' => array('INDEX', 'time'),
|
||||||
'unread' => array('INDEX', 'unread'),
|
'unread' => array('INDEX', 'unread'),
|
||||||
'is_disabled' => array('INDEX', 'is_disabled'),
|
'is_enabled' => array('INDEX', 'is_enabled'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
USER_NOTIFICATIONS_TABLE => array(
|
USER_NOTIFICATIONS_TABLE => array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user