How do I disable attachments for email piping but keep them for tickets and KB? I have commented out all the process attachments function in my pipe_functions.inc.php, but my attachments folder has piled up to 10GB.. looks like a bunch of temp files in folders with the generated random file name.
I have done this. This makes it so there is no attachment in the attachment table, or on the ticket, but the temp files are not being deleted.
What is the best way to delete all these temp folders with the $useChars='AEUYBDGHJLMNPQRSTVWXZ123456789'; name that have piled up??
Code: Select all
// Process attachments
// $tmpvar['attachmment_notices'] = '';
// $tmpvar['attachments'] = '';
// $num = 0;
// if ($hesk_settings['attachments']['use'] && isset($results['attachments'][0]))
// {
// #print_r($results['attachments']);
// foreach ($results['attachments'] as $k => $v)
// {
// Clean attachment names
// $myatt['real_name'] = hesk_cleanFileName($v['orig_name']);
// Check number of attachments, delete any over max number
// if ($num >= $hesk_settings['attachments']['max_number'])
// {
// $tmpvar['attachmment_notices'] .= sprintf($hesklang['attnum'], $myatt['real_name']) . "\n";
// }
// Check file extension
// $ext = strtolower(strrchr($myatt['real_name'], "."));
// if (!in_array($ext,$hesk_settings['attachments']['allowed_types']))
// {
// $tmpvar['attachmment_notices'] .= sprintf($hesklang['atttyp'], $myatt['real_name']) . "\n";
// continue;
// }
// Check file size
// $myatt['size'] = $v['size'];
// if ($myatt['size'] > ($hesk_settings['attachments']['max_size']))
// {
// $tmpvar['attachmment_notices'] .= sprintf($hesklang['attsiz'], $myatt['real_name']) . "\n";
// continue;
// }
// Generate a random file name
// $useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
// $tmp = $useChars{mt_rand(0,29)};
// for($j=1;$j<10;$j++)
// {
// $tmp .= $useChars{mt_rand(0,29)};
// }
// $myatt['saved_name'] = substr($tmpvar['trackid'] . '_' . md5($tmp . $myatt['real_name']), 0, 200) . $ext;
// Rename the temporary file
// rename($v['stored_name'],HESK_PATH.$hesk_settings['attach_dir'].'/'.$myatt['saved_name']);
// Insert into database
// hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('".hesk_dbEscape($tmpvar['trackid'])."','".hesk_dbEscape($myatt['saved_name'])."','".hesk_dbEscape($myatt['real_name'])."','".intval($myatt['size'])."')");
// $tmpvar['attachments'] .= hesk_dbInsertID() . '#' . $myatt['real_name'] .',';
//
// $num++;
// }
// if (strlen($tmpvar['attachmment_notices']))
// {
// $tmpvar['message'] .= "<br /><br />" . hesk_input($hesklang['attrem'],'','',1) . "<br />" . nl2br(hesk_input($tmpvar['attachmment_notices'],'','',1));
// }
// }
// Delete the temporary files
deleteAll($results['tempdir']);