diff options
| author | javiexin <javiexin@gmail.com> | 2015-07-09 20:02:39 +0200 |
|---|---|---|
| committer | javiexin <javiexin@gmail.com> | 2015-07-09 20:02:39 +0200 |
| commit | 054da801144c5e6f70a3c7fcd8244c38e2a1c619 (patch) | |
| tree | dbbdb2dcb9cea44e67a5d0122946167786c557fe /phpBB/phpbb/db/migration/data/v310/avatars.php | |
| parent | 558d604d83fd5ded2edc854a9944ad0d1188e2e5 (diff) | |
| parent | f576f42b4d3c607aee6b30154502adfed79301fb (diff) | |
| download | forums-054da801144c5e6f70a3c7fcd8244c38e2a1c619.tar forums-054da801144c5e6f70a3c7fcd8244c38e2a1c619.tar.gz forums-054da801144c5e6f70a3c7fcd8244c38e2a1c619.tar.bz2 forums-054da801144c5e6f70a3c7fcd8244c38e2a1c619.tar.xz forums-054da801144c5e6f70a3c7fcd8244c38e2a1c619.zip | |
Merge pull request #1 from phpbb/3.1.x
Bring version up to date 20150708
Diffstat (limited to 'phpBB/phpbb/db/migration/data/v310/avatars.php')
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v310/avatars.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php index 2698adeed5..9b03a8fa94 100644 --- a/phpBB/phpbb/db/migration/data/v310/avatars.php +++ b/phpBB/phpbb/db/migration/data/v310/avatars.php @@ -17,7 +17,29 @@ class avatars extends \phpbb\db\migration\migration { public function effectively_installed() { - return isset($this->config['allow_avatar_gravatar']); + // Get current avatar type of guest user + $sql = 'SELECT user_avatar_type + FROM ' . $this->table_prefix . 'users + WHERE user_id = ' . ANONYMOUS; + $result = $this->db->sql_query($sql); + $backup_type = $this->db->sql_fetchfield('user_avatar_type'); + $this->db->sql_freeresult($result); + + // Try to set avatar type to string + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = 'avatar.driver.upload' + WHERE user_id = " . ANONYMOUS; + $this->db->sql_return_on_error(true); + $effectively_installed = $this->db->sql_query($sql); + $this->db->sql_return_on_error(); + + // Restore avatar type of guest user to previous state + $sql = 'UPDATE ' . $this->table_prefix . "users + SET user_avatar_type = '{$backup_type}' + WHERE user_id = " . ANONYMOUS; + $this->db->sql_query($sql); + + return $effectively_installed !== false; } static public function depends_on() |
