function amr_users_clear_all_public_csv($except) { // array of user list numbers $csv_path = amr_users_get_csv_path(); //$csv_files = glob($csv_path.'/user_list_*.csv'); 20140722 //$txt_files = glob($csv_path.'/user_list_*.txt'); foreach ($except as $exception => $public) { if (!$public) { // then there should be no files $file = $csv_path . '/user_list_' . $exception . '.csv'; if (file_exists($file)) { unlink($file); } $file = $csv_path . '/user_list_' . $exception . '.txt'; if (file_exists($file)) { unlink($file); } } } }
function amr_users_clear_all_public_csv($except) { // array of user list numbers $csv_path = amr_users_get_csv_path(); $csv_files = glob($csv_path . '/user_list_*.csv'); foreach ($except as $exception => $public) { if ($public) { $except[$exception] = $csv_path . '/user_list_' . $exception . '.csv'; } else { unset($except[$exception]); } } if (!empty($csv_files)) { foreach ($csv_files as $file) { if (!in_array($file, $except)) { unlink($file); } } } }