Merge remote-tracking branch 'prototech/ticket/12008' into develop

* prototech/ticket/12008:
  [ticket/12008] Update the run time value for the prune notifications cron task
  [ticket/12008] The read_notification_last_gc config setting should be dynamic.
This commit is contained in:
Joas Schilling 2013-11-14 12:38:06 +01:00
commit 692fbf732f
6 changed files with 39 additions and 3 deletions

View file

@ -244,6 +244,7 @@ services:
- @notification.method_collection - @notification.method_collection
- @service_container - @service_container
- @user_loader - @user_loader
- @config
- @dbal.conn - @dbal.conn
- @cache - @cache
- @user - @user

View file

@ -232,7 +232,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '60'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '60');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_expire_days', '30'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_expire_days', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_last_gc', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_gc', '86400'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_gc', '86400');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1');
@ -288,6 +287,7 @@ INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_us
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('plupload_last_gc', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('plupload_last_gc', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed_last_update', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed_last_update', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('read_notification_last_gc', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1);
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_indexing_state', '', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_indexing_state', '', 1);

View file

@ -0,0 +1,27 @@
<?php
/**
*
* @package migration
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbb\db\migration\data\v310;
class notifications_cron_p2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array('\phpbb\db\migration\data\v310\notifications_cron');
}
public function update_data()
{
return array(
// Make read_notification_last_gc dynamic.
array('config.remove', array('read_notification_last_gc')),
array('config.add', array('read_notification_last_gc', 0, 1)),
);
}
}

View file

@ -27,6 +27,9 @@ class manager
/** @var \phpbb\user_loader */ /** @var \phpbb\user_loader */
protected $user_loader; protected $user_loader;
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */ /** @var \phpbb\db\driver\driver */
protected $db; protected $db;
@ -58,6 +61,7 @@ class manager
* @param array $notification_methods * @param array $notification_methods
* @param ContainerBuilder $phpbb_container * @param ContainerBuilder $phpbb_container
* @param \phpbb\user_loader $user_loader * @param \phpbb\user_loader $user_loader
* @param \phpbb\config\config $config
* @param \phpbb\db\driver\driver $db * @param \phpbb\db\driver\driver $db
* @param \phpbb\user $user * @param \phpbb\user $user
* @param string $phpbb_root_path * @param string $phpbb_root_path
@ -67,13 +71,14 @@ class manager
* @param string $user_notifications_table * @param string $user_notifications_table
* @return \phpbb\notification\manager * @return \phpbb\notification\manager
*/ */
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{ {
$this->notification_types = $notification_types; $this->notification_types = $notification_types;
$this->notification_methods = $notification_methods; $this->notification_methods = $notification_methods;
$this->phpbb_container = $phpbb_container; $this->phpbb_container = $phpbb_container;
$this->user_loader = $user_loader; $this->user_loader = $user_loader;
$this->config = $config;
$this->db = $db; $this->db = $db;
$this->cache = $cache; $this->cache = $cache;
$this->user = $user; $this->user = $user;
@ -797,6 +802,8 @@ class manager
WHERE notification_time < ' . (int) $timestamp . WHERE notification_time < ' . (int) $timestamp .
(($only_read) ? ' AND notification_read = 1' : ''); (($only_read) ? ' AND notification_read = 1' : '');
$this->db->sql_query($sql); $this->db->sql_query($sql);
$this->config->set('read_notification_last_gc', time(), false);
} }
/** /**

View file

@ -70,6 +70,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
array(), array(),
$this->container, $this->container,
$this->user_loader, $this->user_loader,
$this->config,
$this->db, $this->db,
$this->cache, $this->cache,
$this->user, $this->user,

View file

@ -118,7 +118,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
// Notification Manager // Notification Manager
$phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(), $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(),
$phpbb_container, $user_loader, $db, $cache, $user, $phpbb_container, $user_loader, $config, $db, $cache, $user,
$phpbb_root_path, $phpEx, $phpbb_root_path, $phpEx,
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE); NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
$phpbb_container->set('notification_manager', $phpbb_notifications); $phpbb_container->set('notification_manager', $phpbb_notifications);