From fb86fb6bfc498840f965379b441b4f6cab2f6ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Sat, 31 Jan 2015 17:15:57 +0100 Subject: [PATCH] Better way of deleting empty lists --- php/nochan.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/php/nochan.php b/php/nochan.php index 5006a221..d9336477 100755 --- a/php/nochan.php +++ b/php/nochan.php @@ -15,11 +15,11 @@ foreach($dir as $files){ $time_lasted = time() - filemtime('./lists/'.$files); if($time_lasted > $to) { - clearstatcache(); - $size = filesize('./lists/'.$files); - if($size < 200){ + $file = file_get_contents('./lists/'.$files); //Checking if the channel has the setting for showing on the frontpage set to true. + $data = json_decode($file, TRUE); + if(sizeof($data["songs"]) == 0) + { unlink("./lists/".$files); - $size; } } if($time_lasted < $time){