Added files used for syncing to source forge

This commit is contained in:
Latif Khalifa
2013-10-10 19:50:24 +02:00
parent a7bd414414
commit 75222d10c0
2 changed files with 29 additions and 0 deletions

22
lib/update_downloads.php Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/php
<?php
define("SITE_ROOT", realpath(dirname(__file__) . "/.."));
require_once SITE_ROOT . "/lib/init.php";
$sync = array("bz2", "log", "exe", "dmg");
$DB->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");