Project

General

Profile

« Previous | Next » 

Revision 7f34387a

Added by Marcos M about 1 year ago

Additional support for repo name in config

View differences:

src/etc/inc/pkg-utils.inc
1153 1153
		$current_repo_path = config_get_path('system/pkg_repo_conf_path');
1154 1154
	}
1155 1155

  
1156
	if ($current_repo_path != $default_repo['path']) {
1156
	if (($current_repo_path != $default_repo['path']) && ($current_repo_path != $default_repo['name'])) {
1157 1157
		config_set_path('system/pkg_repo_conf_path', $default_repo['name']);
1158 1158
		write_config( "Configured default pkg repo after restore");
1159 1159
		pkg_switch_repo();
......
1506 1506

  
1507 1507
/* Find the current or default package help file. */
1508 1508
function pkg_get_repo_help() {
1509
	global $g;
1510

  
1511
	$repo_conf_path = config_get_path('system/pkg_repo_conf_path');
1512 1509
	/* Get the current or the default repo name. */
1513
	$repo_name = pkg_get_repo_name($repo_conf_path);
1514
	$repo_base = "{$g['pkg_repos_path']}/{$g['product_name']}-repo";
1515
	return "{$repo_base}-{$repo_name}.help";
1510
	$saved_repo = pkg_get_repo_name(config_get_path('system/pkg_repo_conf_path'));
1511

  
1512
	$repos = pkg_list_repos();
1513
	foreach ($repos as $repo) {
1514
		if ($saved_repo == $repo['name']) {
1515
			$repo_conf_path = $repo['path'];
1516
			break;
1517
		}
1518
		if (isset($repo['default'])) {
1519
			$repo_conf_path = $repo['path'];
1520
		} elseif (!isset($repo_conf_path)) {
1521
			$repo_conf_path = $repo['path'];
1522
		}
1523
	}
1524

  
1525
	if (!empty($repo_conf_path)) {
1526
		$repo_ext_pos = strrpos($repo_conf_path, '.conf'); 
1527
		if (($repo_ext_pos !== false) && (substr($repo_conf_path, $repo_ext_pos) == '.conf')) {
1528
			$repo_help_path = substr($repo_conf_path, 0, $repo_ext_pos);
1529
			if (!empty($repo_help_path)) {
1530
				return "{$repo_help_path}.help";
1531
			}
1532
		}
1533
	}
1534

  
1535
	/* Default */
1536
	return '';
1516 1537
}
1517 1538

  
1518 1539
/* Switch between stable and devel repos */

Also available in: Unified diff