Project

General

Profile

« Previous | Next » 

Revision 1a2d6d34

Added by Stephen Beaver over 9 years ago

Ensure replacement group name is unique

View differences:

src/etc/inc/upgrade_config.inc
4718 4718
	// Ensure there are no spaces in group names by
4719 4719
	// replacing spaces with underscores
4720 4720
	if (is_array($config['system']['group'])) {
4721
		$exgrps = array();
4722

  
4723
		// Make a list of the existing group names so we can check for dups
4724
		foreach ($config['system']['group'] as $grp) {
4725
			$exgrps[] = $grp['name'];
4726
		}
4727

  
4721 4728
		foreach ($config['system']['group'] as $grp) {
4722 4729
			$grp['name'] = str_replace(" ", "_", $grp['name']);
4730

  
4731
			// In the unlikely event that there is already a group with this name
4732
			// just replace the whole thing with a unique string
4733
			if (in_array($grp['name'], $exgrps)) {
4734
				$grp['name'] = uniqid();
4735
			}
4723 4736
		}
4724 4737
	}
4725 4738
}

Also available in: Unified diff