admin/commits: page to list last git log messages
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 12 Dec 2017 19:36:59 +0000 (20:36 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 12 Dec 2017 21:05:11 +0000 (22:05 +0100)
admin/commits.html [new file with mode: 0644]
admin/commits.php [new file with mode: 0644]

diff --git a/admin/commits.html b/admin/commits.html
new file mode 100644 (file)
index 0000000..c1d69b6
--- /dev/null
@@ -0,0 +1,2 @@
+<h2>Aanpassingen</h2>
+
diff --git a/admin/commits.php b/admin/commits.php
new file mode 100644 (file)
index 0000000..932a556
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+$pagesize = 20;
+$gitcmd = "git log -n $pagesize --pretty='%at\t%an\t%s'";
+
+if ( $log = popen($gitcmd, 'r') ) {
+       print "<ul>\n";
+       while ( $line = fgets($log) ) {
+               list ($atime, $author, $message) = explode("\t", $line, 3);
+               list ($author) = explode(' ', $author); # first name only
+               printf('<li>%s <small class="date">%s • %s</small></li>'."\n",
+                       $message, $author, strftime('%F %H:%M', $atime)
+               );
+       }
+       print "</ul>\n\n";
+       pclose($log);
+}