Find the cause of the abnormal project recently and find that the server's disk space occupies 100%
It turned out that the temporary folder for a package download was full.
This problem has not been considered before, and only a loophole can be filled.
Solution: Empty the expired files before each download, so that it will not take up disk space.
/ * Batch download * /
public function download_project($array)
{
// Cycle delete expired files start
$tmp = 'tmp_down';
$savepath1 = '../public'.$tmp;
$ path1 = dir ($ savepath1);
while (($item = $path1->read())!=false) {
if($item=='.' || $item=='..'){
continue;
}else{
$file = $savepath1.'/'.$item;
$times = time()-filemtime($file);
if($times>24*3600){
unlink($file);
}
}
}
// Cycle delete expired files end
Article source: Liu Juntao's blog Welcome to pay attention to the public number, comments, comments, and study together.
If it is helpful to you, please click to recommend , your support is the best affirmation to me (* ^ _ ^ *)