diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-11-20 17:07:53 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-11-20 17:12:00 +0100 |
commit | 6db967bdd51c7df79ec7095e6d5dc506fbf3f132 (patch) | |
tree | 7c637ab25d38febbe30742254934915d599a7ff5 /phpBB/phpbb | |
parent | 1f624e136785893d0c9e4bfeb1a12f9c08693a24 (diff) | |
download | forums-6db967bdd51c7df79ec7095e6d5dc506fbf3f132.tar forums-6db967bdd51c7df79ec7095e6d5dc506fbf3f132.tar.gz forums-6db967bdd51c7df79ec7095e6d5dc506fbf3f132.tar.bz2 forums-6db967bdd51c7df79ec7095e6d5dc506fbf3f132.tar.xz forums-6db967bdd51c7df79ec7095e6d5dc506fbf3f132.zip |
[ticket/11842] Add migration file for updating avatar type in database
PHPBB3-11842
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/db/migration/data/v310/avatar_types.php | 65 |
1 files changed, 65 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..439e20889c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/avatar_types.php @@ -0,0 +1,65 @@ +<?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 +{ + 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() + { + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.upload' + WHERE user_avatar_type = " . AVATAR_UPLOAD; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.remote' + WHERE user_avatar_type = " . AVATAR_REMOTE; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.local' + WHERE user_avatar_type = " . AVATAR_GALLERY; + $this->db->sql_query($sql); + } + + public function update_group_avatar_type() + { + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.upload' + WHERE group_avatar_type = " . AVATAR_UPLOAD; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.remote' + WHERE group_avatar_type = " . AVATAR_REMOTE; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . "groups + SET group_avatar_type = 'avatar.driver.local' + WHERE group_avatar_type = " . AVATAR_GALLERY; + $this->db->sql_query($sql); + } +} |