Code Duplication    Length = 15-15 lines in 2 locations

other/upgrade.php 1 location

@@ 578-592 (lines=15) @@
575
		require_once($sourcedir . '/Subs-Db-' . $db_type . '.php');
576
577
		// Make the connection...
578
		if (empty($db_connection))
579
		{
580
			$options = array('non_fatal' => true);
581
			// Add in the port if needed
582
			if (!empty($db_port))
583
				$options['port'] = $db_port;
584
			
585
			if (!empty($db_mb4))
586
				$options['db_mb4'] = $db_mb4;
587
			
588
			$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options);
589
		}
590
		else
591
			// If we've returned here, ping/reconnect to be safe
592
			$smcFunc['db_ping']($db_connection);
593
594
		// Oh dear god!!
595
		if ($db_connection === null)

Sources/Session.php 1 location

@@ 163-177 (lines=15) @@
160
		return false;
161
162
	// php < 7.0 need this
163
	if (empty($db_connection))
164
	{
165
		$db_options = array();
166
167
		// Add in the port if needed
168
		if (!empty($db_port))
169
			$db_options['port'] = $db_port;
170
171
		if (!empty($db_mb4))
172
		$db_options['db_mb4'] = $db_mb4;
173
174
		$options = array_merge($db_options, array('persist' => $db_persist, 'dont_select_db' => SMF == 'SSI'));
175
176
		$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options);
177
	}
178
179
	// First try to update an existing row...
180
	$smcFunc['db_query']('', '