#!/usr/bin/php load()) { exit(1); } $last = timestamp(); $twitter = new Twitter($TwitterConsumerKey, $TwitterConsumerSecret, $TwitterAccessToken, $TwitterAccessTokenSecret); for ($i = 0; $i < $db->count(); $i++) { $patch = $db->get($i); if ($last < $patch->getTimestamp()) { $s = $patch->getVendor() . ' released #' . $patch->getProduct(); if (!empty($patch->getBranch())) $s .= ' ' . $patch->getBranch(); $s .= ' version ' . $patch->getVersion() . '.'; $len = strlen($s) + 24; // + space + wrapped URL $s .= ' ' . $patch->getURL(); echo $patch->getId() . ': ' . $len . PHP_EOL; try { $twitter->send($s); } catch (DG\Twitter\Exception $e) { fwrite(STDERR, 'ERROR: ' . $e->getMessage() . PHP_EOL); } } } ?>