#!/usr/bin/php query("begin"); $DB->query("delete from downloads"); if ($dh = opendir(SITE_ROOT)) { while (($file = readdir($dh)) !== false) { $ext = pathinfo($file, PATHINFO_EXTENSION); if (in_array($ext, $sync)) { $q = kl_str_sql("insert into downloads(file_name) values (!s)", $file); $DB->query($q); } } closedir($dh); } $DB->query("commit");