1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Correzionu sull'esportazione CSV da azioni di gruppo

This commit is contained in:
Dasc3er
2020-11-27 15:10:27 +01:00
parent eff17804e5
commit c82165e6fa
12 changed files with 151 additions and 158 deletions

View File

@@ -528,3 +528,33 @@ if (!function_exists('readSQLFile')) {
return $queryLine;
}
}
if (!function_exists('temp_file')) {
/**
* Crea un file temporaneo e lo imposta per la rimozione alla fine dell'esecuzione.
*
* @param $name
* @param $content
*
* @return string
*/
function temp_file($name = null, $content = null)
{
if (empty($name)) {
$name = secure_random_string();
}
$file = DIRECTORY_SEPARATOR.
trim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).
DIRECTORY_SEPARATOR.
ltrim($name, DIRECTORY_SEPARATOR);
file_put_contents($file, $content);
register_shutdown_function(function () use ($file) {
unlink($file);
});
return $file;
}
}