[ticket/11103] Fixing some db columns that were of the incorrect type

PHPBB3-11103
This commit is contained in:
Nathan Guse 2012-09-08 16:02:32 -05:00
parent a4eb8bf47a
commit 1e53f7df9d
6 changed files with 22 additions and 12 deletions

View file

@ -1297,7 +1297,7 @@ function get_schema_struct()
$schema_data['phpbb_notifications'] = array(
'COLUMNS' => array(
'item_type' => array('UINT', 0),
'item_type' => array('VCHAR:25', ''),
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'unread' => array('BOOL', 1),
@ -1775,7 +1775,7 @@ function get_schema_struct()
$schema_data['phpbb_user_notifications'] = array(
'COLUMNS' => array(
'item_type' => array('UINT', 0),
'item_type' => array('VCHAR:25', ''),
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:25', ''),

View file

@ -141,7 +141,7 @@ class phpbb_notifications_service
*/
// find out which users want to receive this type of notification
$notify_users = $item_type_class_name::find_users_for_notification($data);
$notify_users = $item_type_class_name::find_users_for_notification($this->phpbb_container, $data);
// Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item
@ -155,6 +155,11 @@ class phpbb_notifications_service
}
$this->db->sql_freeresult($result);
if (!sizeof($notify_users))
{
return;
}
// Go through each user so we can insert a row in the DB and then notify them by their desired means
foreach ($notify_users as $user => $methods)
{

View file

@ -31,5 +31,5 @@ interface phpbb_notifications_type_interface
public function create_insert_array($type_data);
public function find_users_for_notification($type_data);
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $type_data);
}

View file

@ -7,6 +7,8 @@
*
*/
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @ignore
*/
@ -101,12 +103,13 @@ class phpbb_notifications_type_pm extends phpbb_notifications_type_base
* @param array $pm Data from
* @return array
*/
public function find_users_for_notification($pm)
public static function find_users_for_notification(ContainerBuilder $phpbb_container, $pm)
{
$user = $this->phpbb_container->get('user');
$db = $phpbb_container->get('dbal.conn');
$user = $phpbb_container->get('user');
// Exclude guests, current user and banned users from notifications
unset($pm['recipients'][ANONYMOUS], $pm['recipients'][$user->data['user_id']]);
unset($pm['recipients'][ANONYMOUS]);//, $pm['recipients'][$user->data['user_id']]);
if (!sizeof($pm['recipients']))
{
@ -115,7 +118,7 @@ class phpbb_notifications_type_pm extends phpbb_notifications_type_base
if (!function_exists('phpbb_get_banned_user_ids'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_container->getParameter('core.root_path') . 'includes/functions_user.' . $phpbb_container->getParameter('core.php_ext'));
}
$banned_users = phpbb_get_banned_user_ids(array_keys($pm['recipients']));
$pm['recipients'] = array_diff(array_keys($pm['recipients']), $banned_users);

View file

@ -7,6 +7,8 @@
*
*/
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @ignore
*/

View file

@ -1107,7 +1107,7 @@ function database_update_info()
),
NOTIFICATIONS_TABLE => array(
'COLUMNS' => array(
'item_type' => array('UINT', 0),
'item_type' => array('VCHAR:25', ''),
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'unread' => array('BOOL', 1),
@ -1128,7 +1128,7 @@ function database_update_info()
),
USER_NOTIFICATIONS_TABLE => array(
'COLUMNS' => array(
'item_type' => array('UINT', 0),
'item_type' => array('VCHAR:25', ''),
'item_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'method' => array('VCHAR:25', ''),
@ -2676,10 +2676,10 @@ function change_database_data(&$no_updates, $version)
// Create config value for displaying last subject on forum list
if (!isset($config['display_last_subject']))
{
{
$config->set('display_last_subject', '1');
}
$no_updates = false;
if (!isset($config['assets_version']))