Project

General

Profile

« Previous | Next » 

Revision 0430b1b4

Added by Renato Botelho almost 7 years ago

Fix #8911: Keep configured pkg repository when restoring config

View differences:

src/etc/inc/pfsense-utils.inc
934 934
	if ($section_xml === -1) {
935 935
		return false;
936 936
	}
937

  
938
	/* Save current pkg repo to re-add on new config */
939
	unset($pkg_repo_conf_path);
940
	if ($section_name == "system" &&
941
	    isset($config['system']['pkg_repo_conf_path'])) {
942
		$pkg_repo_conf_path = $config['system']['pkg_repo_conf_path'];
943
	}
944

  
937 945
	$config[$section_name] = &$section_xml;
938 946
	if (file_exists("{$g['tmp_path']}/config.cache")) {
939 947
		unlink("{$g['tmp_path']}/config.cache");
940 948
	}
949

  
950
	/* Restore previously pkg repo configured */
951
	if ($section_name == "system") {
952
		if (isset($pkg_repo_conf_path)) {
953
			$config['system']['pkg_repo_conf_path'] =
954
			    $pkg_repo_conf_path;
955
		} elseif (isset($config['system']['pkg_repo_conf_path'])) {
956
			unset($config['system']['pkg_repo_conf_path']);
957
		}
958
	}
959

  
941 960
	write_config(sprintf(gettext("Restored %s of config file (maybe from CARP partner)"), $section_name));
942 961
	disable_security_checks();
943 962
	return true;

Also available in: Unified diff