From 2e2ddd7e85034f747d5dd312803aadfc47ac80e2 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 4 Mar 2013 10:30:49 +0100 Subject: [PATCH] [feature/avatars] Update module_auth of ucp module and fix small issues Reduced the check effectively_installed() to just checking for the config entry "allow_avatar_gravatar". Also added the missing update of the module_auth of the ucp_profile avatar mode. PHPBB3-10018 --- .../db/migration/data/310/avatars.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/db/migration/data/310/avatars.php b/phpBB/includes/db/migration/data/310/avatars.php index de11a64556..79547337f7 100644 --- a/phpBB/includes/db/migration/data/310/avatars.php +++ b/phpBB/includes/db/migration/data/310/avatars.php @@ -11,15 +11,7 @@ class phpbb_db_migration_data_310_avatars extends phpbb_db_migration { public function effectively_installed() { - $sql = 'SELECT module_auth - FROM ' . MODULES_TABLE . " - WHERE module_class = 'ucp' - AND module_basename = 'ucp_profile' - AND module_mode = 'avatar'"; - $result = $this->db->sql_query($sql); - $module_auth = $this->db->sql_fetchfield('module_auth'); - $this->db->sql_freeresult($result); - return ($module_auth == 'cfg_allow_avatar'); + return isset($this->config['allow_avatar_gravatar']); } static public function depends_on() @@ -59,6 +51,17 @@ class phpbb_db_migration_data_310_avatars extends phpbb_db_migration { return array( array('config.add', array('allow_avatar_gravatar', 0)), + array('custom', array(array($this, 'update_module_auth'))), ); } + + public function update_module_auth() + { + $sql = 'UPDATE ' . $this->table_prefix . "modules + SET module_auth = 'cfg_allow_avatar' + WHERE module_class = 'ucp' + AND module_basename = 'ucp_profile' + AND module_mode = 'avatar'"; + $this->db->sql_query($sql); + } }