Use unlink_if_exists or @unlink to avoid PHP errors when file doesn't exist

Conflicts:
	usr/local/www/firewall_aliases_edit.php
This commit is contained in:
Renato Botelho 2014-02-04 17:01:20 -02:00
parent 4b9011f5c5
commit 4bdb08e3b0
3 changed files with 4 additions and 5 deletions

View File

@ -1823,7 +1823,7 @@ EOD;
} else {
if (file_exists("/conf/{$pppif}.log")) {
conf_mount_rw();
unlink("/conf/{$pppif}.log");
@unlink("/conf/{$pppif}.log");
conf_mount_ro();
}
}

View File

@ -36,8 +36,7 @@
function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
if(file_exists($xmldumpfile))
unlink($xmldumpfile);
unlink_if_exists($xmldumpfile);
exec("$rrdtool dump " . escapeshellarg($rrddatabase) . " {$xmldumpfile} 2>&1", $dumpout, $dumpret);
if ($dumpret <> 0) {

View File

@ -73,7 +73,7 @@ if($_POST)
// Debugging
if($debug)
unlink("{$g['tmp_path']}/alias_rename_log.txt");
unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt");
function alias_same_type($name, $type) {
global $config;
@ -203,7 +203,7 @@ if ($_POST) {
/* fetch down and add in */
$isfirst = 0;
$temp_filename = tempnam("{$g['tmp_path']}/", "alias_import");
unlink($temp_filename);
unlink_if_exists($temp_filename);
mwexec("/bin/mkdir -p {$temp_filename}");
mwexec("/usr/bin/fetch -q -o \"{$temp_filename}/aliases\" " . escapeshellarg($_POST['address' . $x]));
/* if the item is tar gzipped then extract */