diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2013-12-04 17:20:20 +0100 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2013-12-04 17:20:20 +0100 |
| commit | b474917ba3fbb26e50a7145fa904efec949f20ce (patch) | |
| tree | 4de591fc65811bd1b82c7a5f322c55faf41bd406 /phpBB/phpbb | |
| parent | fa33abaf0d6cf5c12e5dadeff2c2d59561e19b22 (diff) | |
| parent | 80fa658e8fc94972349b5f0d01f93afba7744e0e (diff) | |
| download | forums-b474917ba3fbb26e50a7145fa904efec949f20ce.tar forums-b474917ba3fbb26e50a7145fa904efec949f20ce.tar.gz forums-b474917ba3fbb26e50a7145fa904efec949f20ce.tar.bz2 forums-b474917ba3fbb26e50a7145fa904efec949f20ce.tar.xz forums-b474917ba3fbb26e50a7145fa904efec949f20ce.zip | |
Merge remote-tracking branch 'Marc/ticket/11842' into develop
* Marc/ticket/11842:
[ticket/11842] Add functional test for creating group
[ticket/11842] Use avatar_data for obtaining driver that should be deleted
[ticket/11842] Use type map for updating avatar types in database
[ticket/11842] Add missing prefix for group id in avatar data
[ticket/11842] Use only new avatar type in user_delete function
[ticket/11842] Add migration file for updating avatar type in database
[ticket/11842] Replace outdated occurences of user and group avatar_type
[ticket/11842] Use group_id 0 and correct avatar name after creating group
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/avatar_types.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/avatar_types.php b/phpBB/phpbb/db/migration/data/v310/avatar_types.php new file mode 100644 index 0000000000..5750a43ddd --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -0,0 +1,60 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +namespace phpbb\db\migration\data\v310; + +class avatar_types extends \phpbb\db\migration\migration +{ + /** + * @var avatar type map + */ + protected $avatar_type_map = array( + AVATAR_UPLOAD => 'avatar.driver.upload', + AVATAR_REMOTE => 'avatar.driver.remote', + AVATAR_GALLERY => 'avatar.driver.local', + ); + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + '\phpbb\db\migration\data\v310\avatars', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_user_avatar_type'))), + array('custom', array(array($this, 'update_group_avatar_type'))), + ); + } + + public function update_user_avatar_type() + { + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = '$new' + WHERE user_avatar_type = $old"; + $this->db->sql_query($sql); + } + } + + public function update_group_avatar_type() + { + foreach ($this->avatar_type_map as $old => $new) + { + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = '$new' + WHERE group_avatar_type = $old"; + $this->db->sql_query($sql); + } + } +} |
