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:
30
lib/util.php
30
lib/util.php
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user