/**
* The main method: where things happen
*
* @access public
*/
function main()
{
if (isset($this->params['quiet'])) {
$this->quiet = true;
}
$tmp = new Folder(TMP);
$folders = reset($tmp->read());
// read only directories (array[0])
foreach ($folders as $folder) {
$tmp->cd(TMP);
$tmp->cd($folder);
$files = end($tmp->read());
// read only files (array[1])
if (in_array('last_interaction', $files)) {
$file_interaction = (int) file_get_contents($tmp->pwd() . DS . 'last_interaction');
// as each piece is 1Mb, this will give the user the chance of uploading at 13,7 kbps (1,7 kb/s)
if (time() - $file_interaction > 600) {
$this->out("Removing {$folder}");
foreach ($files as $file) {
unlink($tmp->pwd() . DS . $file);
}
$tmp->delete();
}
}
}
}