diff options
Diffstat (limited to 'phpBB/install/database_update.php')
| -rw-r--r-- | phpBB/install/database_update.php | 85 | 
1 files changed, 57 insertions, 28 deletions
| diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 18741191d8..4507e5c371 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2090,42 +2090,68 @@ function change_database_data(&$no_updates, $version)  		// Changes from 3.1.0-dev to 3.1.0-A1  		case '3.1.0-dev': -			set_config('use_system_cron', 0); - -			$sql = 'UPDATE ' . GROUPS_TABLE . ' -				SET group_teampage = 1 -				WHERE group_type = ' . GROUP_SPECIAL . " -					AND group_name = 'ADMINISTRATORS'"; -			_sql($sql, $errored, $error_ary); - -			$sql = 'UPDATE ' . GROUPS_TABLE . ' -				SET group_teampage = 2 -				WHERE group_type = ' . GROUP_SPECIAL . " -					AND group_name = 'GLOBAL_MODERATORS'"; -			_sql($sql, $errored, $error_ary); - -			set_config('legend_sort_groupname', '0'); -			set_config('teampage_multiple', '1'); -			set_config('teampage_forums', '1'); +			if (!isset($config['use_system_cron'])) +			{ +				set_config('use_system_cron', 0); +			} -			$sql = 'SELECT group_id +			$sql = 'SELECT group_teampage  				FROM ' . GROUPS_TABLE . ' -				WHERE group_legend = 1 -				ORDER BY group_name ASC'; -			$result = $db->sql_query($sql); +				WHERE group_teampage > 0'; +			$result = $db->sql_query_limit($sql, 1); +			$added_groups_teampage = (bool) $db->sql_fetchfield('group_teampage'); +			$db->sql_freeresult($result); -			$next_legend = 1; -			while ($row = $db->sql_fetchrow($result)) +			if (!$added_groups_teampage)  			{  				$sql = 'UPDATE ' . GROUPS_TABLE . ' -					SET group_legend = ' . $next_legend . ' -					WHERE group_id = ' . (int) $row['group_id']; +					SET group_teampage = 1 +					WHERE group_type = ' . GROUP_SPECIAL . " +						AND group_name = 'ADMINISTRATORS'"; +				_sql($sql, $errored, $error_ary); + +				$sql = 'UPDATE ' . GROUPS_TABLE . ' +					SET group_teampage = 2 +					WHERE group_type = ' . GROUP_SPECIAL . " +						AND group_name = 'GLOBAL_MODERATORS'";  				_sql($sql, $errored, $error_ary); +			} -				$next_legend++; +			if (!isset($config['use_system_cron'])) +			{ +				set_config('legend_sort_groupname', '0'); +				set_config('teampage_multiple', '1'); +				set_config('teampage_forums', '1');  			} + +			$sql = 'SELECT group_legend +				FROM ' . GROUPS_TABLE . ' +				WHERE group_teampage > 1'; +			$result = $db->sql_query_limit($sql, 1); +			$updated_group_legend = (bool) $db->sql_fetchfield('group_teampage');  			$db->sql_freeresult($result); -			unset($next_legend); + +			if (!$updated_group_legend) +			{ +				$sql = 'SELECT group_id +					FROM ' . GROUPS_TABLE . ' +					WHERE group_legend = 1 +					ORDER BY group_name ASC'; +				$result = $db->sql_query($sql); + +				$next_legend = 1; +				while ($row = $db->sql_fetchrow($result)) +				{ +					$sql = 'UPDATE ' . GROUPS_TABLE . ' +						SET group_legend = ' . $next_legend . ' +						WHERE group_id = ' . (int) $row['group_id']; +					_sql($sql, $errored, $error_ary); + +					$next_legend++; +				} +				$db->sql_freeresult($result); +				unset($next_legend); +			}  			// Install modules  			$modules_to_install = array( @@ -2229,7 +2255,10 @@ function change_database_data(&$no_updates, $version)  			}  			// Allow custom profile fields in pm templates -			set_config('load_cpf_pm', '0'); +			if (!isset($config['load_cpf_pm'])) +			{ +				set_config('load_cpf_pm', '0'); +			}  			$no_updates = false;  		break; | 
