Skip to content

Commit 904c470

Browse files
committed
fixed directory cleanup
1 parent 413a553 commit 904c470

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

index.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,26 @@ static function NukeJob($jobid)
117117
{
118118
@unlink(self::$jobpath . "/" . $jobid);
119119
@unlink(self::$jobpath . "/" . $jobid.".job");
120-
121-
$remover=new FilesystemIterator(self::$dl_dir_common."/".$jobid);
122-
foreach($remover as $item)
120+
if(file_exists(self::$dl_dir_common."/".$jobid))
123121
{
124-
@unlink(self::$dl_dir_common."/".$jobid."/".$item->getFilename());
125-
}
122+
$remover=new FilesystemIterator(self::$dl_dir_common."/".$jobid);
123+
foreach($remover as $item)
124+
{
125+
@unlink(self::$dl_dir_common."/".$jobid."/".$item->getFilename());
126+
}
126127
@rmdir(self::$dl_dir_common."/".$jobid);
127-
128-
$remover=new FilesystemIterator(self::$dl_dir_mp3."/".$jobid);
129-
foreach($remover as $item)
130-
{
131-
@unlink(self::$dl_dir_mp3."/".$jobid."/".$item->getFilename());
128+
@rmdir(self::$yt_dl_temp_path."/".self::$dl_dir_common."/".$jobid);
132129
}
130+
if(file_exists(self::$dl_dir_mp3."/".$jobid))
131+
{
132+
$remover=new FilesystemIterator(self::$dl_dir_mp3."/".$jobid);
133+
foreach($remover as $item)
134+
{
135+
@unlink(self::$dl_dir_mp3."/".$jobid."/".$item->getFilename());
136+
}
133137
@rmdir(self::$dl_dir_mp3."/".$jobid);
138+
@rmdir(self::$yt_dl_temp_path."/".self::$dl_dir_mp3."/".$jobid);
139+
}
134140
}
135141

136142
static function SetupDir($dirname)

0 commit comments

Comments
 (0)