RDiff-Backup and Drupal.

I use rdiff-backup and I like it quite a bit. The only problem I have is finding a decent web front end for it or something. So having used drupal as my cms on my public and private network, I decided to start writing something that would allow me to glean some information out of rdiff-backup. Yes, sure..I could just have cron email me the reports...but I don't want to clutter my inbox. (it's all ready cluttered! ;)

To start my foray, I've created the following php snippet and made it a block inside drupal:
function get_dir($path) {
$dir = dir($path);
while ($file = $dir->read()) {
if (is_dir($path.$file))
continue;

if (!(preg_match("/^session_stat.*$/", $file)))
continue;

$filetime = filemtime($path.$file);
$filetimes[$filetime]= $file;
}
$dir->close();
return $filetimes;
}

$rdiffPath="/backup/rdiff-backup-data/";
$filearr = get_dir($rdiffPath);
ksort($filearr);
$file = array_pop($filearr);
print "".file_get_contents($rdiffPath.$file)."";
-----
This is nothing amazing.. it simply gets the newest session_status file created by rdiff-backup and displays it. I didn't write this myself either. I borrowed some code to get me started but completely re-wrote it to make it a little more elegant once I understood some of the php basics. Also helpful was the php quick reference that contains all php functions.