aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-02-24 11:43:33 +0100
committerMarc Alexander <admin@m-a-styles.de>2015-02-24 11:43:33 +0100
commitb650f45d5597fd6a2864ddcd658df3603deb001f (patch)
treed94746734ecfbd5560e10b012163ff94cdca8872
parent525a62f72e872f8d19e2ec3f2e1c105e9fae4f75 (diff)
downloadforums-b650f45d5597fd6a2864ddcd658df3603deb001f.tar
forums-b650f45d5597fd6a2864ddcd658df3603deb001f.tar.gz
forums-b650f45d5597fd6a2864ddcd658df3603deb001f.tar.bz2
forums-b650f45d5597fd6a2864ddcd658df3603deb001f.tar.xz
forums-b650f45d5597fd6a2864ddcd658df3603deb001f.zip
[ticket/12368] Correctly check if avatars migration is installed
Try to set the avatar type to string value to check if new avatar types are supported. PHPBB3-12368
-rw-r--r--phpBB/phpbb/db/migration/data/v310/avatars.php24
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..51e222532b 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();
+
+ // Return 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()