Unfinished activity ('quantified self') tracker
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

svn.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?PHP
  2. class SvnSource implements Source {
  3. private $data;
  4. public function __construct() {
  5. $cache = dirname(dirname(__FILE__)) . '/cache/svn.dat';
  6. if (file_exists($cache)) {
  7. $this->data = unserialize(file_get_contents($cache));
  8. } else {
  9. $this->data = array('data' => array(), 'processed' => array());
  10. }
  11. foreach (glob('/home/chris/svn/*') as $repo) {
  12. $name = basename($repo);
  13. $titl = '<strong>' . $name . '</strong>';
  14. $revs = count(glob($repo . '/db/revs/*'));
  15. $done = max(1, (int) $this->data['processed'][$name]);
  16. for ($i = $done; $i < $revs; $i++) {
  17. $date = strtotime(substr(`svnlook date $repo -r $i`, 0, 19));
  18. $revh = '<strong>' . $i . '</strong>';
  19. $mesg = '<code>' . htmlentities(trim(`svnlook log $repo -r $i`)) . '</code>';
  20. $mesg = 'Committed revision ' . $revh . ' to ' . $titl . ' with log message ' . $mesg;
  21. $this->data['data'][] = new Event($date, $mesg);
  22. }
  23. $this->data['processed'][$name] = $revs;
  24. }
  25. file_put_contents($cache, serialize($this->data));
  26. unset($this->data['processed']);
  27. }
  28. public function getData() {
  29. return $this->data['data'];
  30. }
  31. }
  32. $_SOURCES[] =& new SvnSource();
  33. ?>