mirror of
https://github.com/pi-hole/web.git
synced 2026-04-25 11:19:59 +01:00
Use a random name when creating intermediat archive for teleporter
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
@@ -89,7 +89,7 @@ function archive_restore_table($file, $table, $flush=false)
|
||||
{
|
||||
$tableExists = $db->querySingle("SELECT name FROM sqlite_master WHERE type='table' AND name='".$table."';");
|
||||
if ($tableExists)
|
||||
{
|
||||
{
|
||||
$db->exec("DELETE FROM \"".$table."\"");
|
||||
array_push($flushed_tables, $table);
|
||||
}
|
||||
@@ -354,6 +354,7 @@ if(isset($_POST["action"]))
|
||||
}
|
||||
|
||||
$fullfilename = sys_get_temp_dir()."/".$filename;
|
||||
|
||||
if(!move_uploaded_file($source, $fullfilename))
|
||||
{
|
||||
die("Failed moving ".htmlentities($source)." to ".htmlentities($fullfilename));
|
||||
@@ -603,7 +604,10 @@ else
|
||||
$hostname = gethostname() ? str_replace(".", "_", gethostname())."-" : "";
|
||||
$tarname = "pi-hole-".$hostname."teleporter_".date("Y-m-d_H-i-s").".tar";
|
||||
$filename = $tarname.".gz";
|
||||
$archive_file_name = sys_get_temp_dir() ."/". $tarname;
|
||||
$archive_file_name = tempnam(sys_get_temp_dir(), 'pihole_teleporter_'); //create a random file name in the system's tmp dir for the intermediat archive
|
||||
unlink($archive_file_name); //remove intermediate file created by tempnam()
|
||||
$archive_file_name .= ".tar"; // Append ".tar" extension
|
||||
|
||||
$archive = new PharData($archive_file_name);
|
||||
|
||||
if ($archive->isWritable() !== TRUE) {
|
||||
|
||||
Reference in New Issue
Block a user