Project

General

Profile

« Previous | Next » 

Revision df309b37

Added by Marcus Brown almost 15 years ago

If mpd.conf files exists in the /conf directory, link to it instead of
generating a new one from config.xml data.

This allows power users to tweak mpd conf to their delight, and gives
devs a way of testing out conf tweaks without needing to alter php code.

View differences:

etc/inc/interfaces.inc
1107 1107
				break;
1108 1108
		}
1109 1109
	}
1110

  
1111
	/* generate mpd.conf */
1112
	$fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w");
1113
	if (!$fd) {
1114
		log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n");
1115
		return 0;
1116
	}
1117 1110
	
1118 1111
	if (is_array($ports) && count($ports) > 1)
1119 1112
		$multilink = "enable";
......
1368 1361
		$mpdconf .= "\topen\r\n";
1369 1362
	} //end foreach($port)
1370 1363

  
1371
	// Write out mpd_ppp.conf
1372
	fwrite($fd, $mpdconf);
1373
	fclose($fd);
1364

  
1365
	/* Generate mpd.conf. If mpd_[interface].conf exists in the conf path, then link to it instead of generating a fresh conf file. */
1366
	if (file_exists("{$g['conf_path']}/mpd_{$interface}.conf"))
1367
		mwexec("/bin/ln -s {$g['conf_path']}/mpd_{$interface}.conf {$g['varetc_path']}/.");
1368
	else {
1369
		$fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w");
1370
		if (!$fd) {
1371
			log_error("Error: cannot open mpd_{$interface}.conf in interface_ppps_configure().\n");
1372
			return 0;
1373
		}
1374
		// Write out mpd_ppp.conf
1375
		fwrite($fd, $mpdconf);
1376
		fclose($fd);
1377
	}
1374 1378

  
1375 1379
	// Create the uptime log if requested and if it doesn't exist already, or delete it if it is no longer requested.
1376 1380
	if (isset($ppp['uptime'])) {

Also available in: Unified diff