diff options
| author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-21 10:46:48 +0200 |
|---|---|---|
| committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-21 10:47:20 +0200 |
| commit | a7ba640ea778bf1936a035952f99b78497feef22 (patch) | |
| tree | dfc62d74b8f55e5bd7549502b73f1d7ec4bdd052 /phpBB/phpbb/db/migration/data/v320/notifications_board.php | |
| parent | db600d840dcea361cb96237f3f15533f2a4fdc3b (diff) | |
| download | forums-a7ba640ea778bf1936a035952f99b78497feef22.tar forums-a7ba640ea778bf1936a035952f99b78497feef22.tar.gz forums-a7ba640ea778bf1936a035952f99b78497feef22.tar.bz2 forums-a7ba640ea778bf1936a035952f99b78497feef22.tar.xz forums-a7ba640ea778bf1936a035952f99b78497feef22.zip | |
[ticket/14182] Move v310\notifications_board migration to v320\...
PHPBB3-14182
Diffstat (limited to 'phpBB/phpbb/db/migration/data/v320/notifications_board.php')
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v320/notifications_board.php | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/migration/data/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php new file mode 100644 index 0000000000..fd9f1a2ad6 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php @@ -0,0 +1,73 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v320; + +class notifications_board extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\notifications'); + } + + public function update_data() + { + return array( + array('config.add', array('allow_board_notifications', 1)), + array('custom', array(array($this, 'update_user_subscriptions'))), + array('custom', array(array($this, 'update_module'))), + ); + } + + public function update_module() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET auth = 'cfg_allow_board_notifications' + WHERE module_basename = 'ucp_notifications' + AND module_mode = 'notification_list'"; + $this->sql_query($sql); + } + + public function update_user_subscriptions() + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = 'notification.method.board' + WHERE method = ''"; + $this->sql_query($sql); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'revert_user_subscriptions'))), + array('custom', array(array($this, 'revert_module'))), + ); + } + + public function revert_user_subscriptions() + { + $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . " + SET method = '' + WHERE method = 'notification.method.board'"; + $this->sql_query($sql); + } + + public function revert_module() + { + $sql = 'UPDATE ' . MODULES_TABLE . " + SET auth = '' + WHERE module_basename = 'ucp_notifications' + AND module_mode = 'notification_list'"; + $this->sql_query($sql); + } +} |
