Project

General

Profile

« Previous | Next » 

Revision 61ee7f13

Added by Phil Davis over 9 years ago

Redmine #5613 avoid Reset to Factory Defaults PHP warnings

On Reset to Factory Defaults there are some warnings given when unlink_if_exists() tries to unlink() directories in /conf - /conf/backup and /conf/sshd.
unlink does not work on directories.
This PR avoids the PHP warnings by not trying to remove the directories inside /conf.

As has been the case before this PR, the following things are thus left on the system after Reset to Factory Defaults:
/conf/backup - old config backups, which contain configs of the previous system.
/conf/sshd - old ssh keys.

For testing, this is handy. But for real "reset" should these be deleted?
In addition to this PR, should there be code to delete everything in /conf/backup and/or /conf/sshd?

View differences:

src/etc/inc/config.lib.inc
618 618
	/* clear out /conf */
619 619
	$dh = opendir($g['conf_path']);
620 620
	while ($filename = readdir($dh)) {
621
		if (($filename != ".") && ($filename != "..")) {
621
		if (($filename != ".") && ($filename != "..") && (!is_dir($g['conf_path'] . "/" . $filename))) {
622 622
			unlink_if_exists($g['conf_path'] . "/" . $filename);
623 623
		}
624 624
	}

Also available in: Unified diff