diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-04-06 11:36:04 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-04-06 11:36:04 +0200 |
commit | 2962d5d7fd39d37b52fa14c7de91bb03477c072a (patch) | |
tree | 6fe7b3f2c37119087c66516c7a27e6d9d192d8b8 /phpBB/phpbb | |
parent | 34b768cfaf2924b1f8bf2e3940db518fc1e1d83b (diff) | |
parent | 90025ae3e762ac599604e031db7eb57d71abdf73 (diff) | |
download | forums-2962d5d7fd39d37b52fa14c7de91bb03477c072a.tar forums-2962d5d7fd39d37b52fa14c7de91bb03477c072a.tar.gz forums-2962d5d7fd39d37b52fa14c7de91bb03477c072a.tar.bz2 forums-2962d5d7fd39d37b52fa14c7de91bb03477c072a.tar.xz forums-2962d5d7fd39d37b52fa14c7de91bb03477c072a.zip |
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/phpbb')
-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() |