#!/usr/bin/php query( kl_str_sql( "insert into revs (id, hash, author, time, message) values (!i, !s, !s, !t, !s)", $id, $hash, $author, $date, $msg)); } function update_source() { exec("git reset --hard", $out, $res); if ($res) { DBH::log("Command failed: ", implode("\n", $out)); return; } exec("git pull", $out, $res); if ($res) { DBH::log("Command failed: ", implode("\n", $out)); return; } print implode("\n", $out) . "\n"; } function update_revs() { global $DB; $revsStr = rtrim(`git rev-list HEAD | tac`); $revs = explode("\n", $revsStr); $nrRevs = count($revs); $latest = 0; $res = $DB->query("select max(id) as id from revs"); if ($row = $DB->fetchRow($res)) { if ($DB->loadFromDbRow($dbLatest, $res, $row)) { $latest = (int)$dbLatest->id; } } print "Found $nrRevs revisions\n"; print "Latest revision in the database: $latest\n"; if ($latest < $nrRevs) { for ($rev = $latest + 1; $rev <= $nrRevs; $rev++) { import_rev($rev, $revs[$rev - 1]); } } } function update_builds() { global $DB; $builds = glob(SITE_ROOT . "/*_*_Setup.exe"); $latest = 0; // check if table exists if (!($res = $DB->query("select max(id) as id from builds"))) { $DB->query("create table builds(nr integer, channel varchar, file varchar, primary key(nr, channel)"); } var_dump($builds); } chdir(SITE_ROOT . "/lib/source"); // update_source(); // update_revs(); chdir(SITE_ROOT); update_builds(); /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */